I am attempting to define an attribute within my XSD that can represent something like the following:
This almost does the trick:
However, I would like to require that the enrollment number matches the following restriction:
Is there a way to combine these two definitions to create a "childless" element that meets this restriction and has an attribute? Thanks for your time.
Nick Ruiz
Code:
<EnrollmentNumber alias="Account Number">0013423521</EnrollmentNumber>
This almost does the trick:
Code:
<xs:element name="EnrollmentNumber">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute ref="alias" default="Enrollment Number"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
However, I would like to require that the enrollment number matches the following restriction:
Code:
<xs:element name="EnrollmentNumber">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\d{10}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
Is there a way to combine these two definitions to create a "childless" element that meets this restriction and has an attribute? Thanks for your time.
Nick Ruiz