Jump to content
Sign in to follow this  
jo_rocks

dtd problem

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...