[Home] [By Thread] [By Date] [Recent Entries]

  • To: "Morgan V. Cundiff" <mcundiff@l...>,<xml-dev@l...>
  • Subject: RE: content model question
  • From: "Tom Gaven" <tgaven@v...>
  • Date: Fri, 5 Apr 2002 09:16:27 -0800
  • Thread-index: AcHcw1fUmBdf45qJRX2ELTKJ2MGmWwAAiWKg
  • Thread-topic: content model question

Morgan, 
   I don't think XML Schema schemas can constrain text this way. I believe XML Schema is similar
to DTD 'mixed content' in this regards.  However, RELAX NG does have this capability:

This RELAX NG schema: (compact syntax)

start = myelement
myelement = element myelement { text, mysubelement1, mysubelement2 }
mysubelement1 = element mysubelement1 { text }
mysubelement2 = element mysubelement2 { text }

should validate your document, and only allow 'text' prior to element mysubelementt.

tom

-----Original Message-----
From: Morgan V. Cundiff [mailto:mcundiff@l...]
Sent: Friday, April 05, 2002 11:57 AM
To: xml-dev@l...
Subject:  content model question



Is is possible to create an XML Schema content model for an element
containing mixed content (i.e. text and subelements) and to also specify
the sequence of the text and the subelements? For example an instance
might look like this:

<myelement>textblob
<mysubelement1>textblob1</mysubelement1>
<mysubelement2>textblob2</mysubelement2>
</myelement>

The goal is to constrain the content of <myelement> so that the textblob
must occur first and then be followed by <mysubelement1> and
<mysubelement2>

Thank you for your help.

Morgan Cundiff
Library of Congress




-----------------------------------------------------------------
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>


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member