[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [xml-dev] Element Occurrence and #PCDATA
Dan,
> Is the syntax (#PCDATA)* ever meaningful?
Essentially what this says is that you may have any number of repeating
#PCDATA sections. So imagine you had a #PCDATA section that said "Dan" and
one that said "Mabbut"-- now put them together: "Dan Mabbut" technically
this is a single #PCDATA section not two together right? Essentially it has
meaning but the only time this is important is when you have mixed element
content like:
<p>Dan Mabbut<i>is</i>very<b>great</b>!</p>
Here we do have multiple #PCDATA sections which are separated by elements
(hence the phrase "mixed content"). You would declare this as follows:
<!ELEMENT p (#PCDATA | i | b)*>
Notice the similarity-- this time instead of having a repeating choice for
only #PCDATA we have a repeating choice for #PCDATA, <i>, and <b> as our
element content. (#PCDATA must always come first in mixed content
definitions).
Back to your original question: (#PCDATA)* is just a watered down mixed
content definition-- there are just no child elements in the mix. Therefore
this definition is allowed-- but it is unnecessary-- in any situation where
(#PCDATA)*
will work--
(#PCDATA)
will work also.
I am sure you knew most of this-- hope this answers the question--
Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting