Specify different Use attribute of SimpleType when inherited?
Posted: Mon Nov 14, 2011 10:50 pm
First, I am evaluating OxygenXML and so far have found it to be a very good, capable xml and xml schema development tool. Thank you!
That said, I am also relatively new to xml schemas, their syntax and capabilities for describing a particular xml syntax. So, given this example schema code:
I am wondering how to achieve what I asked for in the annotation for Element2 in the code?
Thanks in advance for any help with this!
That said, I am also relatively new to xml schemas, their syntax and capabilities for describing a particular xml syntax. So, given this example schema code:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:complexType name="BaseElementType">
<xs:attribute name="Attr1" type="xs:string" use="required"/>
<xs:attribute name="Attr2" type="xs:unsignedByte" use="optional"/>
<xs:attribute name="Attr3" type="xs:unsignedShort" use="optional"/>
</xs:complexType>
<xs:element name="Element1" type="BaseElementType">
<xs:annotation>
<xs:documentation>
This element uses the base element attributes as specified, where Attr1
is a required attribute, but Attr2 and Attr3 are optional.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Element2" type="BaseElementType">
<xs:annotation>
<xs:documentation>
This element uses the base element attributes but for this element I
want Attr2 to be a required attribute.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>
Thanks in advance for any help with this!