jo_rocks Posted April 15, 2012 Share Posted April 15, 2012 Hi all, I have the follow problem, I have an xml file that have this, this xml file can't be changed: <root> <title>Hello</title> <content> <title>Weekend</title> </content></root> I must have a DTD that must validate the xml, now the problem is that I have two nodes with the same name title, this is my proposal, but it doesn't pass the validation, because I can't declare the same name more than once: <!ELEMENT root (title, content)><!ELEMENT title (#PCDATA)><!ELEMENT content (title)><!ELEMENT title (#PCDATA)> This is a school project, and I am obligated to use a dtd to validate an xml. Thanks all! 1 Link to comment Share on other sites More sharing options...
Ingolme Posted April 15, 2012 Share Posted April 15, 2012 You don't need to define the same element twice. If you want an element to contain itself, I think this works: <!ELEMENT title (title|#PCDATA)> 1 Link to comment Share on other sites More sharing options...
jo_rocks Posted April 15, 2012 Author Share Posted April 15, 2012 Thanks a lot Foxy Mod. It worked!!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now