Reputation: 450
I'm writing an Xml schema where I want an element that has some attributes as a complexType and a simpleContent based on string. I wanted it to also preserve whitespace. Right now I have this snippet:
<xs:complexType name="actualType">
<xs:simpleContent>
<xs:extension base="stringWithSpace">
<xs:attribute name="a" type="xs:int"/>
<xs:attribute name="b" type="xs:int"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="stringWithSpace">
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve" />
</xs:restriction>
</xs:simpleType>
The question is, do I need to have two separate types to get the attributes and the preserved whitespace or is there something I missed?
Upvotes: 0
Views: 1633
Reputation: 450
I'm seeing confirmation that this is just the standard way to do this as expressed in the question's original snippet. I'm answering the question so anyone who searches for this later can receive the same confirmation.
Upvotes: 1