DTD Question - PCDATA followed by an optional element

Kragen Sitaker kragen at pobox.com
Wed Nov 17 23:16:32 GMT 1999

Norman Samuelson asks:
>To include the comment, I would like to be able to simply say:
>   <!ELEMENT comment (#PCDATA)>
>   <!ELEMENT rho0 (#PCDATA, comment?)>
>That doesn't seem to be acceptable.  I also tried:
>   <!ELEMENT rho0 ((#PCDATA) | (#PCDATA, comment))>
>Is it possible to do what I want?

No.  Section 3.2.2 of REC-xml:
	An element type has mixed content when elements of that type
	may contain character data, optionally interspersed with child
	elements. In this case, the types of the child elements may be
	constrained, but not their order or their number of

The best you can do is (#PCDATA|comment)*.

<kragen at pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)

More information about the Xml-dev mailing list