- From: Tommi Penttinen <tpenttin@cs.uku.fi>
- Date: Thu, 30 May 2002 15:02:56 +0300 (EEST)
- To: XML Schema news group <xmlschema-dev@w3.org>
Hello,
we wanted to write a schema for XML documents that can have any elements,
with attributes from a different namespace describing their properties.
Thus, we defined the elements with xs:any. The question is, how can you
specify that only certain attributes can be used with these elements?
And / or can you force validation of these attributes? An example XML
document and a part of the schema follow:
<xw:wrapper xmlns:xw="http://www.cs.uku.fi/XW/2001" xw:sourcetype="text">
<document xw:childterminator="\n">
<row xw:minoccurs="0" xw:maxoccurs="unbounded"/>
</document>
</xw:wrapper>
And here is the schema excerpt:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0"
targetNamespace="http://www.cs.uku.fi/XW/2001"
xmlns:tns="http://www.cs.uku.fi/XW/2001"
elementFormDefault="qualified"
attributeFormDefault="qualified">
...
<xs:complexType name="Elements">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="ELEMENT" type="tns:Element"/>
<xs:any namespace="##local" processContents="lax"/>
</xs:choice>
</xs:complexType>
</xs:schema>
Thanks in advance.
- Tommi
Received on Thursday, 30 May 2002 08:04:09 UTC