Say I have the following (simplistic) schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="RootNode"> <xs:complexType> <xs:sequence> <xs:element name="FirstChildElement" type="Integer8Type" minOccurs="1"/> <xs:element name="SecondChildElement" type="Integer8Type" minOccurs="1"/> </xs:sequence> </xs:complexType> </xs:element> <xs:simpleType name="Integer8Type"> <xs:restriction base="xs:integer"> <xs:minInclusive value="0"/> <xs:maxInclusive value="99999999"/> </xs:restriction> </xs:simpleType> </xs:schema>
I have "Integer8Type" as a custom type. Now, keeping it so that my "FirstChildElement" element is of "Integer8Type", how can I define that the "FirstChildElement" element has an attribute? I've looked everywhere I can think of and I can't find an example that would keep that element as type "Integer8Type". It always shows that I'd have to make the "FirstChildElement" element a complex type. Could anyone point me in the right direction where I can find the relevant information on defining attributes for custom typed elements?
thnx,
Christoph
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="RootNode"> <xs:complexType> <xs:sequence> <xs:element name="FirstChildElement" type="Integer8Type" minOccurs="1"/> <xs:element name="SecondChildElement" type="Integer8Type" minOccurs="1"/> </xs:sequence> </xs:complexType> </xs:element> <xs:simpleType name="Integer8Type"> <xs:restriction base="xs:integer"> <xs:minInclusive value="0"/> <xs:maxInclusive value="99999999"/> </xs:restriction> </xs:simpleType> </xs:schema>
I have "Integer8Type" as a custom type. Now, keeping it so that my "FirstChildElement" element is of "Integer8Type", how can I define that the "FirstChildElement" element has an attribute? I've looked everywhere I can think of and I can't find an example that would keep that element as type "Integer8Type". It always shows that I'd have to make the "FirstChildElement" element a complex type. Could anyone point me in the right direction where I can find the relevant information on defining attributes for custom typed elements?
thnx,
Christoph