W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2001

Forcing a certain document element

From: Ian Stokes-Rees <ian@decisionsoft.com>
Date: Fri, 12 Jan 2001 17:09:54 +0000
Message-ID: <3A5F3A62.DF32776B@decisionsoft.com>
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
I would like to force a single document element to be valid in my
schema, however I have designed my sechma so it looks like (for
illustration purposes only):

<schema>
  <element name="documentElement">
    <complexType>
      <element ref="someRefElement" minOccurs="0"
maxOccurs="unbounded"/>
    </complexType>
  </element>

  <element name="someRefElement">
    <complexType>
      <attribute name="foo" use="required"/>
      <attribute name="bar" use="required"/>
    </complexType>
  </element>
</schema>

And I would like this XML document to validate:
 
<documentElement>
  <someRefElement foo="1" bar="2"/>
</documentElement>

But not have this validate:

<someRefElement foo="1" bar="2" />

(where "someRefElement" is the document element).

How can I use XSDL to enforce this?

Ian.
-- 
ian.stokes-rees@decisionsoft.com          tel: +1865 203 192
DecisionSoft Ltd.                         fax: +1865 203 194
www.decisionsoft.com                      Oxford, UK, OX2 OEA
Received on Friday, 12 January 2001 12:09:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:19 GMT