Jump to content

jo_rocks

Recommended Posts

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!

  • Like 1
Link to comment
Share on other sites

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)>

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...