XML concise tutorial lesson 7th: apply data types in XML documents

Source: Internet
Author: User
Tags xml parser
What is the data type in XML documents? The data type in the XML document is the type assigned to an element in the instance. it can be implemented by using the dt: dt attribute, or by using an XMLSchema and a formal definition of an XML document. What is the data type in XML documents?
The data type in the XML document is the type assigned to an element in the instance. it can be implemented using the dt: dt attribute or
It is implemented through an XML Schema and a formal definition of an XML document. In addition, the data type can be declared as RMB
XML parser to verify the validity of the document.
Previously, the values of XML elements were limited to a single String type, so developers who want to process XML documents needed
It takes a large amount of time to convert all values in the exploitation program into one type. When the data is imported, the parser will note
It refers to the conversion of data types. In addition, because these values are assigned a specific data type
Conversion complies with the data type specification, which provides a method to verify the effectiveness of user input.
In addition to a String value, each XML element can also have a type-defined value, for example, the following XML element
Su:
1970-09-30
How to define the data type of XML element values?
Take a look at the following XML document:
 

1970-09-30  
67.5  
 
Here, 'weatherschema. XML' is the following file.
Rosoft-com: datatypes '>
 
 

 
 
 
 
The schema above is a formal definition that assigns the data type to the preceding XML document. The attribute xmlns is a declarative domain.
And declare 'xmlns: dt = 'urn: schemas-microsoft-com: PES ypes ''to assign dt to the domain name.
'Urn: schemas-microsoft-com: PES ypes. '. any data type defined as dt belongs to the domain 'urn: sch
Emas-microsoft-com: datatypes .'.
Schema and data type name fields should be declared at the beginning of XML Schema, so that the dt header can be used to instigate data
The type attribute applied in the type definition.
Rosoft-com: datatypes '>
 
Define types for elements in XML documents
The element can be defined by the dt attribute of the element instance.
Data type domain.

44533 
 
The dt header can now assign the data type to the element instance as the dt attribute.
Apply data types as elements in XML documents
In addition to declaring the data type in the instance or schema of the element, the data type can also be used as an element application.
In the following example, the first example declares the data type in the element instance:
'/>


10 
12 
 
The second example declares the type as an element:
Y1 '/>

 
8  
10  
12  
 
However, it is impossible to define the type of such elements through schema.
In the XML Data Types Reference, there is a list of Data Types that can be applied in the XML document.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.