1
Good morning!
I have the following element in an XML:
<estcivil unestavel="S">C</estcivil>
It turns out that my attribute can only receive "S" or "N" values, but the element has other value restrictions, such as: "C","S","D","V". How could you generate these two constraints in Schema XSD, one for the element and the other for the attribute?.
My XSD is like this:
<xs:element name="estcivil" maxOccurs="1" ref="ESTCIV">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="unestavel" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="S|N"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
being the ESTCIV:
<xs:simpleType name="ESTCIV">
<xs:restriction base="xs:string">
<xs:enumeration value="C"/>
<xs:enumeration value="D"/>
<xs:enumeration value="P"/>
<xs:enumeration value="S"/>
<xs:enumeration value="U"/>
<xs:enumeration value="V"/>
</xs:restriction>
</xs:simpleType>
Thank you.