XML Tutorial/XML Schema/nonNegativeInteger

Материал из Web эксперт
Версия от 11:26, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

The nonNegativeInteger datatype is derived from the integer type.

   <source lang="xml">

The value space is the infinite set of integers greater than or equal to zero. The lexical space is a finite-length sequence of decimal digits with an optional leading - or +.

<xsd:element name="bank_balance"

 type="xsd:nonNegativeInteger"/>

<bank_balance>32</bank_balance></source>


Use nonNegativeInteger

   <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:nonNegativeInteger" />

</xs:schema>

File: Data.xml <?xml version="1.0"?> <population xmlns="http://www.wbex.ru">342</population></source>