Site Maintenance this evening The site will be offline for hosting changes. Time TBC

+ Post New Thread
Results 1 to 4 of 4
Coding Thread, XML Error - Content of element type "root" must match "(url)" in Coding and Web Development; Hello, I have wrote a PHP script that writes a sitemap so that it can be dynamically updated when a ...
  1. #1

    Join Date
    May 2009
    Posts
    8
    Thank Post
    3
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    XML Error - Content of element type "root" must match "(url)"

    Hello,

    I have wrote a PHP script that writes a sitemap so that it can be dynamically updated when a user changes the website layout. Below is the xml structure that i cannot see any problems with but i cannot get it validated.

    The error that comes up is:

    Content of element type "root" must match "(url)".


    Here is the xml code,

    <?xml version="1.0" ?>
    <!DOCTYPE root [
    <!ELEMENT root (url)>
    <!ELEMENT url (#PCDATA)>
    ]>
    <root>
    <url>http://whatever.co.uk/</url>
    <url>http://whatever.co.uk/about/</url>
    <url>http://whatever.co.uk/contact/</url>
    <url>http://whatever.co.uk/services/</url>
    <url>http://whatever.co.uk/</url>
    <url>http://whatever.co.uk/</url>
    <url>http://whatever.co.uk/test3/</url>
    <url>http://whatever.co.uk/</url>
    <url>http://whatever.co.uk/my-name/</url>
    <url>http://whatever.co.uk/test5/</url>
    </root>

    Can anyone help me here?

    Thanks a lot everyone.

    Eddie

  2. #2

    Join Date
    May 2009
    Location
    Sheffield
    Posts
    247
    Thank Post
    23
    Thanked 37 Times in 28 Posts
    Rep Power
    20
    Not messed around with dtd's but I'll bet that removing the (URL) bit will fix it...

    Other things to try:
    - put the dtd somewhere separately and reference it by urn
    - miss out the dtd altogether - your XML looks well-formed and you don't need it

  3. #3

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115
    Lot's of XML but I'm not a DTD person either, however I think(!) that says "root" is an element within "root" which it isn't. If I couldn't find a way to avoid it altogether I'd try this instead:

    <!DOCTYPE root [
    <!ELEMENT url (#PCDATA)>
    ]>

  4. Thanks to PiqueABoo from:

    eddie (11th September 2009)

  5. #4

    Join Date
    May 2009
    Posts
    8
    Thank Post
    3
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thanks very much guys!!

    Just for anyone that reads this and has this problem, I removed the <!ELEMENT root (url)> and that fixed it. Like you said, it was trying to find a 'root' element within the 'root' tags.

    Thanks again chaps

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 2
    Last Post: 11th August 2009, 11:08 AM
  2. Exchange 2008 : Can't type in "short form" email address
    By cjohnsonuk in forum Windows Server 2008
    Replies: 8
    Last Post: 26th September 2008, 08:58 PM
  3. HELP "Username and password do not match"
    By dhasmet in forum EduGeek Joomla 1.5 Package
    Replies: 3
    Last Post: 3rd August 2008, 09:40 AM
  4. "Error 403" & "Moved to here" message
    By tech_guy in forum Windows
    Replies: 4
    Last Post: 24th January 2008, 01:07 PM
  5. Replies: 6
    Last Post: 28th September 2006, 07:06 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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