T
Thomas Marti
Hello
I have the following problem: I want to have an XML-Schema that only
declares one Attribute, but does not specify in which specific Element it
has to be used. I've already tried the following:
------- agnes.xsd --------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schematargetNamespace="http://agnes.sf.net/ns/agnes"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" xmlns="http://agnes.sf.net/ns/agnes">
<xsd:complexType name="agnesType">
<xsd:attribute name="id" type="idType"/>
</xsd:complexType>
<xsd:simpleType name="idType">
<xsd:restriction base="xsd:token">
<xsdattern value="AGID_[0-9a-zA-Z]{16}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
------- agnes.xsd --------------------------------------------------
The intented use of this Schema would be:
------- whatever.xsd -----------------------------------------------
<whatever xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:agnes="http://agnes.sf.net/ns/agnes"
xsi:schemaLocation="http://agnes.sf.net/ns/agnes agnes.xsd"
agnes:id="AGID_1234567890abcdef">
<foo>
<bar/>
</foo>
</whatever>
------- whatever.xsd -----------------------------------------------
But XMLSpy outputs the following error:
'No Content Model available for validation (possibly empty DTD/Schema)'
=> So the question is: How can I declare an Attribute in it's own Schema so
that it can be used in different kinds of elements?
I have the following problem: I want to have an XML-Schema that only
declares one Attribute, but does not specify in which specific Element it
has to be used. I've already tried the following:
------- agnes.xsd --------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schematargetNamespace="http://agnes.sf.net/ns/agnes"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" xmlns="http://agnes.sf.net/ns/agnes">
<xsd:complexType name="agnesType">
<xsd:attribute name="id" type="idType"/>
</xsd:complexType>
<xsd:simpleType name="idType">
<xsd:restriction base="xsd:token">
<xsdattern value="AGID_[0-9a-zA-Z]{16}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
------- agnes.xsd --------------------------------------------------
The intented use of this Schema would be:
------- whatever.xsd -----------------------------------------------
<whatever xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:agnes="http://agnes.sf.net/ns/agnes"
xsi:schemaLocation="http://agnes.sf.net/ns/agnes agnes.xsd"
agnes:id="AGID_1234567890abcdef">
<foo>
<bar/>
</foo>
</whatever>
------- whatever.xsd -----------------------------------------------
But XMLSpy outputs the following error:
'No Content Model available for validation (possibly empty DTD/Schema)'
=> So the question is: How can I declare an Attribute in it's own Schema so
that it can be used in different kinds of elements?