[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Embedding Content as Element Content or As An Attribute Value

  • From: Chris Maden <crism@o...>
  • To: xml-dev@i...
  • Date: Thu, 8 Jan 1998 17:13:04 -0500

ebnf examples
[Tyler Baker]
> After getting used to the syntax of XML for defining a DTD, I am a
> little perplexed about an element declaration of the form:
> 
> <!ELEMENT Foo (bar1 | bar2 | bar3)*>
> 
> vs.
> 
> <!ELEMENT Foo (bar1, bar2, bar3)*>
> 
> Apparently in the first example element Foo can have 0 or more bar1,
> bar2, or bar3 attributes but only one of these, excluding the other,
> and the second example element says that you have 0 or more
> sequences of bar1, bar2, and bar3 attributes.  My confusion is that
> in the DTD's I have seen so far, the first example element is used
> as if attributes bar1, bar2, and bar3 can all exist together or else
> as a combination of two, or else singularly.  But in EBNF notation
> the ' | ' as far as I know means one or the other and not both.

You are confused about many things.  The | in EBNF means what you
think.  DTDs are not EBNF (note the lack of '::=').  The first example
means zero or more of (bar1 | bar2 | bar3) - each of that "zero or
more" must be only one of those, but there is no restriction that it
be the same bar every time.  The model you describe would be (bar1* |
bar2* | bar3*).

> <!ELEMENT Foo (bar1?, bar2?, bar3?)>
> 
> Last but not least this example element seems to mean the same thing
> as the second example element.

The asterisk in (bar1, bar2, bar3)* means zero or more sequences of
bar1, bar2, bar3.  The third element declaration's (bar1?, bar2?,
bar3?), means an optional bar1 (zero or one), followed by an optional
bar2, followed by an optional bar3.  There may not be another bar1
after bar3, as there may be in the second element declaration.

> I am sorry to be posting this "please help me" post to an xml-dev
> list (which I assume is mostly for parser writing discussion), but I
> have tried in the short time I have been on this list I have tried
> to post pointers to parser writers that help them in their quest for
> optimal importance so I don't feel too guilty (-:

The best place for questions like this is probably comp.text.sgml.  I
also recommend _Practical SGML_ by Erik van Herwijnen, Kluwer
Academic, ISBN 0792394348.  Of the XML books thus far published,
_Presenting XML_ has some discussion of content models that hasn't
been obsoleted; _XML Complete_ has some discussion if you can pick
amongst the Java programming examples that comprise most of the book.

> Any info on this would be greatly appreciated as I cannot find any
> FAQ which explains this in detail other than the current XML spec
> which IMHO has a lot of ambiguities that are not clearly explained
> and therefore relatively confusing to anyone who does not have
> extensive experience in the SGML camp.

<URL:http://www.ucc.ie/xml/> is the XML FAQ, maintained by Peter
Flynn.  Ambiguities should probably be pointed out to the editors.
There are few or no ambiguities in the Platonic spec, in the heads of
the Working Group, but that Platonic ideal is not captured perfectly
in the published spec.

-Chris
-- 
<!NOTATION SGML.Geek PUBLIC "-//Anonymous//NOTATION SGML Geek//EN">
<!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
"<URL>http://www.oreilly.com/people/staff/crism/ <TEL>+1.617.499.7487
<USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.