XML/XML Schema/token

Материал из Web эксперт
Перейти к: навигация, поиск

Based on data type token

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.wbex.ru" xmlns="http://www.wbex.ru"
  elementFormDefault="qualified">
  <xs:simpleType name="string255">
    <xs:restriction base="xs:token">
      <xs:maxLength value="255" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="string32">
    <xs:restriction base="xs:token">
      <xs:maxLength value="32" />
    </xs:restriction>
  </xs:simpleType>
</xs:schema>



xs:pattern and xs:token

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.wbex.ru" xmlns="http://www.wbex.ru"
  elementFormDefault="qualified">
  <xs:simpleType name="CapitalizedNameWS">
    <xs:restriction base="xs:token">
      <xs:pattern value="([A-Z]([a-z]*) ?)+" />
    </xs:restriction>
  </xs:simpleType>
</xs:schema>