Text OR Fixed structure in an ELEMENT

L

luckyroom505

Hello,

I try to make a DTD for a structure like this:

<notelist>
<note><to>john</to><subj>i have a question</subj></note>
<note>my pin code is 1111</note>
</notelist>

I tried:

<!DOCTYPE notelist[
<!ELEMENT notelist (note*)>
<!ELEMENT note (#PCDATA|(to, subj)) >
<!ELEMENT to (#PCDATA)>
<!ELEMENT subj (#PCDATA)>
]>

but it does not validate (iE6.0)

Any ideas?
LR
 
J

Johannes Koch

Richard said:
You can't do that in a DTD. The best you can do is allow any mixture
of <to>, <subj>, and text.

Or use two different elements:
<structuredNote><to>john</to><subj>i have a question</subj></structuredNote>
<note>my pin code is 1111</note>
 
H

Harrie

Johannes Koch said the following on 11/22/2005 14:08 +0200:
Or use two different elements:
<structuredNote><to>john</to><subj>i have a
question</subj></structuredNote>
<note>my pin code is 1111</note>

Or eliminate one "note" element (I renamed some elements, it made more
sence to me that way, YMMV).

<note>
<to>john</to>
<subj>i have a question</subj>
<text>my pin code is 1111</text>
</note>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,850
Latest member
VMRKlaus8

Latest Threads

Top