W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2003

Re: how to define an XML Document with an unknown/variable element

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 9 Jul 2003 09:58:29 +0100
Message-ID: <20167767506.20030709095829@jenitennison.com>
To: remko de knikker <remko.deknikker@yale.edu>
CC: xmlschema-dev@w3.org

Hi Remko,

> Except for the fact that the response is always an XML Document with
> the root <xsd:element name="method2Response">. Is there a way to
> define this??

Yes. Use an <xs:any> wildcard in the content model for your element:

<xs:element name="method2Response">
  <xs:complexType>
    <xs:sequence>
      <xs:any />
    </xs:sequence>
  </xs:complexType>
</xs:element>

You can put minOccurs/maxOccurs attributes on the wildcard if there
are multiple elements within the method2Response element.

You can also use the namespace attribute on <xs:any> if you want to
limit the namespaces that the elements can belong to.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Wednesday, 9 July 2003 04:58:33 GMT

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