As in the scheme to describe the condition that the text in the element always consists of a single letter of the Latin alphabet included in the HEX format.

<?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:attribute name="C"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:length value="4"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:element name="A"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="B"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute ref="C" use="required" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element maxOccurs="unbounded" name="D"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute ref="C" use="required" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> 
  • And what does “one letter of the Latin alphabet” mean? in after can be just one letter or in the field can be any number of letters (or can be a fixed number, or from one to n), but the same ones? - StateItPrimitive
  • @StateItPrimitive in the field (in the name of the element) there can be only 1 letter in total, it is necessarily Latin and necessarily included in the HEX format. Is it possible to simply prescribe from A to F or is there a special data type for this manipulation? - Insightrader
  • Once you need the name of the element, you will only have to go through xs:choice (and you will have to explicitly list all the options one by one, since you cannot specify only the format of the string in this element). - StateItPrimitive
  • @StateItPrimitve thanks for the tip! Actually, I don’t think how to do it through xs: choise. If you can by example - it will be cool! - Insightrader
  • Try this for example. - StateItPrimitive pm

1 answer 1

For example, so

 <xsd:element name="hex1"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:enumeration value="A"/> <xsd:enumeration value="B"/> <xsd:enumeration value="C"/> <xsd:enumeration value="D"/> <xsd:enumeration value="E"/> <xsd:enumeration value="F"/> </xsd:restriction> </xsd:simpleType> </xsd:element> 

Or so

 <xsd:element name="hex2"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:pattern value="[A-Fa-f]"/> </xsd:restriction> </xsd:simpleType> </xsd:element>