eddie (11th September 2009)
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
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
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)>
]>
eddie (11th September 2009)
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![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)