XML Tutorial/XML Schema/decimal

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

The decimal data type represents a finite-length sequence of digits separated by a period.

   <source lang="xml">

<xsd:element name="money">

 <xsd:simpleType>
  <xsd:restriction base="xsd:decimal">
   <xsd:totalDigits value="4"/>
   <xsd:fractionDigits value="2"/>
  </xsd:restriction>
 </xsd:simpleType>

</xsd:element>

<money>14.98</money></source>


Use decimal

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

</xs:schema>

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