- From: Eddie Robertsson <eddie@allette.com.au>
- Date: Thu, 14 Jun 2001 09:52:45 +1000
- To: Tom Elrod <telrod@e2technologies.net>
- CC: xmlschema-dev@w3.org
Hi Tom,
> I am building an XML Schema and I would like one of the elements to
> allow any sub-elements of any type (I won't know what they are) and
> require that there is one particular sub-element. The schema and sample
> XML is included below. The element 'Recipient' is the one that I want
> to allow any number of sub elements (such as 'FirstName'), but require
> the 'email' element be there.
Have you tried using xsd:any?
xsd:any let you have any Well-Formed XML and you can specify if you want the
processor to validate the content and from which namespace the elements can
be declared in. Have a look at [1] for more details.
In your schema you could declare your element Recipient like:
<xsd:element name="Recipient">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="email" type="xsd:string"/>
<xsd:any processContents="skip" namespace="##any" minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Cheers,
/Eddie
[1] http://www.w3.org/TR/xmlschema-0/#any
Received on Wednesday, 13 June 2001 19:52:00 UTC