[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [xml-dev] Element Occurrence and #PCDATA
If an element is just #PCDATA, then an occurance indicator shouldn't
be present, i.e.,
<!ELEMENT a (#PCDATA)>
Only data is allowed. However, if you have mixed content, #PCDATA
and other elements, then a * (zero or one) is required, i.e.,
<!ELEMENT a (#PCDATA | b | c)*>
I think an important point is that the parser doesn't really validate
that data is present. In both examples, <a></a> will pass the parse.
Hope this helps.
Betty
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Betty Harvey, XML Consultant, | Phone: 410-787-9200 FAX: 9830
Electronic Commerce Connection, Inc. |
harvey@eccnet.com | Washington,DC SGML/XML Users Grp
URL: http://www.eccnet.com | http://www.eccnet.com/xmlug/
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/
On Tue, 20 Nov 2001, Dan Mabbutt wrote:
> Betty,
>
> Thanks for the response, but it wasn't quite what I was asking. I'm aware of
> the differences between CDATA and #PCDATA. (I only mentioned that because it
> was the subject of the single authoritative reference I could find in
> Simon's book.) I should have been more clear in my question, but I didn't
> want to suggest my own conclusion too strongly.
>
> My question is about the use of the Element Occurrence Indicator in this
> syntax. That would suggest that the DTD is requiring zero or more
> occurrences of #PCDATA and I can't quite imagine why it would ever be
> meaningful to include that syntax in the DTD.
>
> Dan
> -----Original Message-----
> From: Betty Harvey [mailto:harvey@eccnet.com]
> Sent: Tuesday, November 20, 2001 7:09 AM
> To: Dan Mabbutt
> Cc: Simon St.Laurent; xml-dev@lists.xml.org
> Subject: Re: [xml-dev] Element Occurrence and #PCDATA
>
> Dan:
>
> #PCDATA represents "Parsed Character Data". Years ago when I
> first started working with SGML, I had the same question. I saw the
> #PCDATA and thought what is the difference between Personal Computer (PC)
> Data and UNIX or VMS data. Basically is means that the parsers looks at
> every character.
>
> Character Data (CDATA - only valid in attributes and
> Marked Sections in XML) says that the parser will not look at the
> characters in a CDATA element.
>
> Hope this helps.
>
> Betty
>
> /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
> Betty Harvey, XML Consultant, | Phone: 410-787-9200 FAX: 9830
> Electronic Commerce Connection, Inc. |
> harvey@eccnet.com | Washington,DC SGML/XML Users Grp
> URL: http://www.eccnet.com | http://www.eccnet.com/xmlug/
> /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/
>
>
> On Tue, 20 Nov 2001, Dan Mabbutt wrote:
>
> > I have a question about a slightly obscure syntax of #PCDATA in a DTD.
> >
> > Is the syntax (#PCDATA)* ever meaningful?
> >
> > I've searched the archives for this group, Googled the Web, and searched
> > every text I have. The only references I can find are in "XML For
> Dummies"
> > (2nd Ed.) where the syntax is used quite extensively on page 85 and 86 and
> > one single reference on page 232 of Simon St. Laurent's "XML A Primer" by
> > Simon St.Laurent that is really about CDATA and the use of the syntax may,
> > or may not, be meaningful. (That's why this message is also directed to
> Mr.
> > St.Laurent.)
> >
> > Thanks!
> >
> > Dan Mabbutt
> >
> >
> > -----------------------------------------------------------------
> > The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> > initiative of OASIS <http://www.oasis-open.org>
> >
> > The list archives are at http://lists.xml.org/archives/xml-dev/
> >
> > To subscribe or unsubscribe from this list use the subscription
> > manager: <http://lists.xml.org/ob/adm.pl>
> >
>
> --
>
>
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
>
>
--