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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Fwd: DTD - mixed content model

[ Lists Home | Date Index | Thread Index ]


>From: "james walker" <jameswalkerandy@hotmail.com>
>To: gkholman@CraneSoftwrights.com, xml-dev@lists.xml.org
>Subject: DTD - mixed content model
>Date: Mon, 26 Jul 2004 16:10:52 +0100
>
>I have an element "link" which contains:
>-1 name element
>-0 or 1 description elements
>-0 or 1 url elements
>-0 or 1 image elements
>the elements underneath link can be in any order.
>
>I am getting confused with the mixed content model

What you are trying to model is not mixed content ... that term is used 
when mixing elements with text.  You are modeling element content.

>when trying to construct this into a DTD. the ststement i have at the 
>moment is:
>
><!ELEMENT link (name | description? | url? | image?)*>
>
>but i tested to see if i could leave the name element out and it accepted 
>the xml document as valid!?!?

Yes ....

>so it looks like the * overrides anything inside the bracket.

"Override" is too strong a term ... you are just being too permissive by 
allowing the choice group to have no occurrences, thus you are allowing 
<link> to be empty.

>I thought the star just meant "these elements can be in any order

Where did you read this?  That is not an aspect of the operator.

>and can range from 0-many unless overridden"?

The "*" Kleene operator is only for cardinality ... the particle to which 
it is attached is optional and repeatable.  I don't know what you mean by 
"overridden" as I cannot think of such a construct in XML.

>Does anybody know the correct way to write this?
>
>if i had another element "place" with 3 elements beneath:
>-1 name element
>-0 to many descriptions
>-0 to many urls
>these can be in any order

Sounds like it is simply:

   <!ELEMENT place ( ( description | url )*, name, ( description | url )* )>

Which reads:

   "any number including zero of a mixture of description or url elements,
   followed by a name, followed by any number including zero of a mixture
   of description or url elements"

I think that meets your criteria completely.

I hope this helps.

.......................... Ken

--
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal





 

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

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