Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts

    Exclamation please help with validating my xml file.

    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
    Last edited by LJackson; 04-19-2009 at 01:58 PM.

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by LJackson View Post
    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.c...stprodfeed.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

  • Users who have thanked oesxyl for this post:

    LJackson (04-19-2009)

  • #3
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    ah ok thanks mate, its not an rss feed i will have a look for an xml validator

    cheers

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by LJackson View Post
    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?

    Edit: remove doctype from second line or fix it to be valid.

    best regards
    Last edited by oesxyl; 04-19-2009 at 12:53 AM.

  • #5
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    nope

    can you provide me with a link to one please?

  • #6
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by LJackson View Post
    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:
    Code:
    <!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:
    Code:
    <?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:
    Code:
    <?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:
    Code:
    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

  • Users who have thanked oesxyl for this post:

    LJackson (04-19-2009)

  • #7
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    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
    Last edited by LJackson; 04-19-2009 at 01:13 AM.

  • #8
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by LJackson View Post
    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

  • #9
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    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?
    Code:
    <!DOCTYPE html SYSTEM"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.kernow-connect.com/xmlschema.dtd">
    cheers
    Last edited by LJackson; 04-19-2009 at 02:16 PM.

  • #10
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    ok mate i now have a valid xml document

    im not sure ive done it correctly but here is what i have done
    Code:
    <?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...om/feeds/testp
    rodfeed.xml

    does this look ok?

    cheers
    Luke

  • #11
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Code:
    <?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

  • #12
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    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=ht...Inline&group=0

    cheers
    Luke

  • #13
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by LJackson View Post
    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=ht...Inline&group=0

    cheers
    Luke
    for example on line 173:
    Code:
    #  <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

  • #14
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    ??? 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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •