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

Fwd: DTD - mixed content model

  • To: XML-Dev Mailing list <xml-dev@l...>
  • Subject: Fwd: DTD - mixed content model
  • From: "G. Ken Holman" <gkholman@C...>
  • Date: Mon, 26 Jul 2004 21:14:14 -0400

mixed content model

>From: "james walker" <jameswalkerandy@h...>
>To: gkholman@C..., xml-dev@l...
>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@C...
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


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.