xs:whiteSpace defines whitespace and can expand the set of accepted instance documents during a "restriction," : whiteSpace « XML Schema « XML






xs:whiteSpace defines whitespace and can expand the set of accepted instance documents during a "restriction,"

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.java2s.com" 
  xmlns="http://www.java2s.com"
  elementFormDefault="qualified">
  
  <xsd:simpleType name="greetings">
    <xsd:restriction base="xsd:string">
      <xsd:whiteSpace value="replace" />
      <xsd:enumeration value="hi" />
      <xsd:enumeration value="hello" />
      <xsd:enumeration value="how do you do?" />
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="restricted-greetings">
    <xsd:restriction base="greetings">
      <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
  </xsd:simpleType>
</xsd:schema>

 








Related examples in the same category

1.xs:whiteSpace defines the way to handle whitespaces