XML Tutorial/XML Schema/positiveInteger
Версия от 21:22, 25 мая 2010; (обсуждение)
The positiveInteger datatype is derived from the nonNegativeInteger type.
<source lang="xml">
The value space is the infinite set of integers greater than or equal to 1. The lexical space is a finite-length sequence of decimal digits with an optional leading +.
<xsd:complexType name="record_sets">
<xsd:sequence> <xsd:element name="record" minOccurs="0" maxOccurs="unbounded"> <xsd:simpleType> <xsd:restriction base="xsd:positiveInteger"> <xsd:pattern value="555\d{3}"/> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:sequence>
</xsd:complexType>
<record>555158</record> <record>555687</record> <record>555736</record></source>
Use positiveInteger
<source lang="xml">
File: Schema.xml <?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:element name="population" type="xs:positiveInteger" />
</xs:schema>
File: Data.xml <?xml version="1.0"?> <population xmlns="http://www.wbex.ru">342</population></source>