...

View Full Version : please help with validating my xml file.



LJackson
04-18-2009, 10:58 PM
Hi All,

I have created an xml file but i have just ran a validation check on it and it doesnt validate :(

please help me validate this xml file im not sure whats wrong with it :)

many thanks
Luke

p.s i have read the help links but havent been able to solve my problem :( any ideas

oesxyl
04-18-2009, 11:32 PM
Hi All,

I have created an xml file but i have just ran a validation check on it and it doesnt validate :(

here is the link
http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fwww.kernow-connect.com%2Ffeeds%2Ftestprodfeed.xml

please help me validate this xml file im not sure whats wrong with it :)

many thanks
Luke

p.s i have read the help links but havent been able to solve my problem :( any ideas
if your xml is a rss feed then don't much the rss schema for the version you want to use but if is not a rss feed then using a rss validator to validate is wrong because any valid xml which is not rss will be invalid.

best regards

LJackson
04-18-2009, 11:44 PM
ah ok thanks mate, its not an rss feed i will have a look for an xml validator :)

cheers

oesxyl
04-18-2009, 11:49 PM
ah ok thanks mate, its not an rss feed i will have a look for an xml validator :)

cheers
in this case you must validate the file against a schema. Do you have one or know a place you can find?

remove doctype from second line or fix it to be valid.
best regards

LJackson
04-18-2009, 11:52 PM
nope :)

can you provide me with a link to one please?

oesxyl
04-19-2009, 12:01 AM
nope :)

can you provide me with a link to one please?
schema is the description of the structure of your xml file.
This is the schema for your file( automate extraction, you must correct it if is wrong)
in few formats:

dtd:


<!ELEMENT stores (store)+>
<!ATTLIST stores
xmlns CDATA #FIXED ''>

<!ELEMENT store (name,title,topitem,desc,itemlink,price)>
<!ATTLIST store
xmlns CDATA #FIXED ''>

<!ELEMENT name (#PCDATA)>
<!ATTLIST name
xmlns CDATA #FIXED ''>

<!ELEMENT title (#PCDATA)>
<!ATTLIST title
xmlns CDATA #FIXED ''>

<!ELEMENT topitem (#PCDATA)>
<!ATTLIST topitem
xmlns CDATA #FIXED ''>

<!ELEMENT desc (#PCDATA)>
<!ATTLIST desc
xmlns CDATA #FIXED ''>

<!ELEMENT itemlink (#PCDATA)>
<!ATTLIST itemlink
xmlns CDATA #FIXED ''>

<!ELEMENT price (#PCDATA)>
<!ATTLIST price
xmlns CDATA #FIXED ''>


xsd:


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="stores">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="store"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="store">
<xs:complexType>
<xs:sequence>
<xs:element ref="name"/>
<xs:element ref="title"/>
<xs:element ref="topitem"/>
<xs:element ref="desc"/>
<xs:element ref="itemlink"/>
<xs:element ref="price"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="name" type="xs:NCName"/>
<xs:element name="title" type="xs:string"/>
<xs:element name="topitem" type="xs:anyURI"/>
<xs:element name="desc" type="xs:string"/>
<xs:element name="itemlink" type="xs:anyURI"/>
<xs:element name="price" type="xs:string"/>

</xs:schema>


rng:


<?xml version="1.0" encoding="UTF-8"?>
<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<element name="stores">
<oneOrMore>
<element name="store">
<element name="name">
<data type="NCName"/>
</element>
<element name="title">
<text/>
</element>
<element name="topitem">
<data type="anyURI"/>
</element>
<element name="desc">
<text/>
</element>
<element name="itemlink">
<data type="anyURI"/>
</element>
<element name="price">
<text/>
</element>
</element>
</oneOrMore>
</element>
</start>

</grammar>


rnc:


default namespace = ""

start =
element stores {
element store {
element name { xsd:NCName },
element title { text },
element topitem { xsd:anyURI },
element desc { text },
element itemlink { xsd:anyURI },
element price { text }
}+
}


best regards

LJackson
04-19-2009, 12:09 AM
thanks for the info and time spent on the above, unfortunatly i dont know what to do with it :(

the dtd looks like the one which i am most familiar with but what do i do with it? do i add it to my curent file or save it and then link to it in my current xml file...

or is it none of those lol

cheers mate
Luke

looking more closley at the above maybe xsd would be the best to use :)

oesxyl
04-19-2009, 12:21 AM
thanks for the info and time spent on the above, unfortunatly i dont know what to do with it :(
you are welcome. there are few validators, offline and probably online which can use such schema for validation. I post in all this format because I don't know what validation tool you can use.


the dtd looks like the one which i am most familiar with but what do i do with it? do i add it to my curent file or save it and then link to it in my current xml file...
then use dtd. Put the dtd file somewhere, write a doctype declaration who point to that file( a valid one) and validate.


or is it none of those lol

cheers mate
Luke

looking more closley at the above maybe xsd would be the best to use :)
I prefere rnc/rng.

best regards

LJackson
04-19-2009, 12:41 PM
ok cheers mate,

just to confirm save the above dtd file as a .dtd file e.g xmlschema.dtd?

and then in my xml file declare it?

cheers mate

p.s here is a doc type which i have done is it a valid doc type?

<!DOCTYPE html SYSTEM"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.kernow-connect.com/xmlschema.dtd">


cheers

LJackson
04-19-2009, 01:34 PM
ok mate i now have a valid xml document :D

im not sure ive done it correctly but here is what i have done

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE stores SYSTEM "http://www.kernow-connect.com/xmlschema.dtd">
<stores>
<store>
<name>Play</name>
<title>Slumdog Millionaire</title>
<topitem>http://images.play.com/covers/5890462m.jpg</topitem>
<desc>A Penniless, eighteen year-old orphan from the slums of Mumbai, he's one question away from winning a staggering 20 million rupees on India's "Who Wants To Be A Millionaire?" But when the show breaks for the night, suddenly, he is arrested on suspicion of cheating.</desc>
<itemlink>http://www.awin1.com/cread.php?awinmid=1418&amp;awinaffid=79524&amp;clickref=playtop&amp;p=http%3A%2F%2Fwww.play.com%2FDVD%2FDVD%2F4-%2F5890462%2FSlumdog-Millionaire%2FProduct.html%23</itemlink>
<price>11.99</price>
</store>
</stores>


and here is the results page from the validator
http://www.validome.org/xml/validate/?lang=en&url=http://www.kernow-connect.com/feeds/testp
rodfeed.xml

does this look ok?

cheers
Luke

oesxyl
04-19-2009, 06:38 PM
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE stores SYSTEM "http://www.kernow-connect.com/xmlschema.dtd">
<stores>
<store>
<name>Play</name>
<title>Slumdog Millionaire</title>
<topitem>http://images.play.com/covers/5890462m.jpg</topitem>
<desc>A Penniless, eighteen year-old orphan from the slums of Mumbai, he's one question away from winning a staggering 20 million rupees on India's "Who Wants To Be A Millionaire?" But when the show breaks for the night, suddenly, he is arrested on suspicion of cheating.</desc>
<itemlink>http://www.awin1.com/cread.php?awinmid=1418&amp;awinaffid=79524&amp;clickref=playtop&amp;p=http%3A%2F%2Fwww.play.com%2FDVD%2FDVD%2F4-%2F5890462%2FSlumdog-Millionaire%2FProduct.html%23</itemlink>
<price>11.99</price>
</store>
</stores>

this, yellow part, must be the path to your dtd file.

best regards

LJackson
04-19-2009, 08:21 PM
hi mate that is the path to my dtd file, so is everything else ok?

also when i validate my php page im getting 21 errors related to the links within my feed which im not sure why im getting the errors as each of the &'s i have replaced with &amp;

here is the link to the validation results
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.kernow-connect.com%2Fentertainment.php&charset=(detect+automatically)&doctype=Inline&group=0

cheers
Luke

oesxyl
04-19-2009, 08:36 PM
hi mate that is the path to my dtd file, so is everything else ok?

also when i validate my php page im getting 21 errors related to the links within my feed which im not sure why im getting the errors as each of the &'s i have replaced with &amp;

here is the link to the validation results
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.kernow-connect.com%2Fentertainment.php&charset=(detect+automatically)&doctype=Inline&group=0

cheers
Luke
for example on line 173:


# <a href='http://www.awin1.com/cread.php?awinmid=1418&awinaffid=79524&clickref=playtop&p=http%3A%2F%2Fwww.play.com%2FDVD%2FDVD%2F4-%2F5890462%2FSlumdog-Millionaire%2FProduct.html%23' target='_blank'>

I'm not sure but I guess you use don't use the proper tool for validation.

best regards

LJackson
04-19-2009, 08:51 PM
??? dont know mate, its the one ive always used :)

but never mind i will ask over at the html/css section i think it was advised to use it over there thy may be able to help :)

thank you very much for all your help above, really appreciate it

Luke



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum