Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTD with subsets and PCDATA? 1

Status
Not open for further replies.

Jay6464

Programmer
Jun 23, 2008
5
EU
Hi there, I'm struggling with writing a DTD for an existing XML document.

Essentially, the set <value> is used as a subset several times throughout the document. In some instances, <value> could contain further subsets, or it could contain #PCDATA.

In trying to define this in the DTD I'm finding errors when I use: <!ELEMENT value (#PCDATA, delEcsmC?, delEcsmT?......)>

or: <!ELEMENT value (#PCDATA | delEcsmC?, delEcsmT?......)>

Can anyone help me with what the entry to the DTD should look like? many thanks
 
><!ELEMENT value (#PCDATA | delEcsmC?, delEcsmT?......)>
[tt]<!ELEMENT value (#PCDATA|delEcsmC|delEcsmT|...)*>[/tt]
 
Thanks for your reply but that does not work, it expects the entry to accept and contain all of those values in sequence, and (from my understanding) would look like this:

<value>Some text about something <delEcsmC>avalue</delEcsmC> maybe more text <delEcsmT>anothervalue</delEcsmC>

Certainly, the W3C validator did not mark it as valid XML and has created a lot more errors. Any other ideas?
 
But the line you show above does not need a dtd to prove itself as invalid.
 
It is mal-formed, mind you. Don't even need to know any reference/source of it.
 
Ok, well I appreciate your help, would it help if I posted the error messages from W3C? I unfortunatel cannot post the original XMLs or DTD as they are the IP of the company I'm with
 
I must apologise, I mis-read your original reply, adding the * after ) solved the validation error, many thanks!
 
I appreciate your stick to it and read it proper eventually. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top