OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Must DTDs constrain order?

[ Lists Home | Date Index | Thread Index ]
  • From: Wayne Steele <xmlmaster@hotmail.com>
  • To: xml-dev@lists.xml.org
  • Date: Fri, 27 Oct 2000 19:36:02 -0700 (PDT)


I have had to deal with this frequently.
Here are several choices I've made at different times:

   1. Express the {baz,bar,bang} information using attributes instead of 
elements.

   2. As Soumitra said, use <!ELEMENT foo (bar |  bat  | bang)*>
      I would put a comment next to this, as well:
         <!-- no more than one of each of these, in any order -->

   3. Do the combinatorial explosion yourself. You would probably also want 
to include a comment so human DTD readers can figure out what's going on 
without too much pain.
  <!-- foo must contain one of each of {bar,baz,bang} in any order -->
  <!ELEMENT foo (
            (bar, ((baz,bang)|(bang,baz)) ) |
            (baz, ((bar,bang)|(bang,bar)) ) |
            (bang,((bar,baz) |(baz,bar))  )
           ) >

   4. Use SGML instead of XML for this application, and use "&".

Ha Ha! Ok, I've never actually used SGML outside of XML. I was just kidding.


-Wayne Steele


>From: Soumitra Sengupta <soumitra@b-bop.com>
>Reply-To: soumitra@b-bop.com
>To: Michael Rossi <mrossi@crusher.jcals.csc.com>
>CC: xml-dev@lists.xml.org
>Subject: Re: Must DTDs constrain order?
>Date: Fri, 27 Oct 2000 10:56:54 -0700
>
>
>
>Michael Rossi wrote:
>
> > Evan Lenz wrote:
> > >
> > > In a DTD, is it possible to not constrain order on a given set of 
>possible
> > > elements, while still constraining quantity?
> > >
> > > For example
> > >
> > > <!ELEMENT foo (bar, bat?, bang*)>
> > >
> > > Can I somehow allow bar, bat, and bang to be in any order?  I suspect 
>not
> > > but would love to be corrected.
>
>I do not know what model you are planning to use but you could try the
>following:
>
><!ELEMENT foo (bar |  bat  | bang)*>
>
>It will not be unambiguous but will allow you to get it done.
>
>--
>Soumitra Sengupta, Ph.D.
>Co-Founder and C.T.O.
>B-Bop Associates Inc.
>Phone: 650-340-2700
>Fax  : 650-340-2701
>Email: soumitra@b-bop.com
>http://www.b-bop.com
>
><< soumitra.vcf >>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS