A, XML
1 Overview:
Extensible Markup Language can be extended markup language. Development: labels can be customized.
2, features:
Storing data. Application, the configuration file, transmitted in the network.
3, XML and HTML differences:
1, XML tags are custom HTML tags are pre-defined
2, XML syntax strict HTML syntax loose
3, XML data is stored in HTML is to show data
Second, grammar
1, the basic syntax:
1 "file name suffix .xml
2 "XML document declaration must be the first line
3 "one and only one root tag
4 "attribute value must be enclosed in quotes
5 'tag must be properly closed
6 "XML rigorous case-sensitive
2, part of
1 "document declaration
Format:
<? Xml list of attributes?>
List of attributes: version version number
encoding formatted default ISO-8859-1
standalone whether to rely on other documents yes no dependence is not dependent
2 "command
<?xml-stylesheet type="text/css href=""kgc.css"?>
3 "label
The name can contain letters, numbers, but numbers do not begin with the name can not start with xml, the name can not contain spaces
4 "attribute id
It represents a unique
5 "Text
CDATA
3, constraint
1 "agreement XML document writing rules
As a user of the frame (programmer) requires
1, the constraint can be introduced in XML
2, the constraint can read documents
2 "binding classification
1, DTD: a simple constraint
2, schema: a complex constraint
3 "How to use
1, the introduction of constraint documents to XML DTD file
Local:
<! DOCTYPE root tag name SYSTEM "dtd file path">
Network:
<! DOCTYPE root tag name PUBLIC "dtd file URL address">
2, the introduction of schema
1, fill in the root element of the XML document
2, the introduction of the prefix xmlns: xsi = http: //www.w3.org/20001/xml
3, the introduction of the namespace xsd file xsi: schemaLocation = "http://www.kgc.cn/xml"
4, for each constraint specifies a prefix xsd xmlns = "http://www.kgc.cn/xml" as the identification
Third, resolve
1 Overview:
Manipulate XML documents, XML document into memory
1 ", resolve
Read, read the document into memory
2 ", written
The in-memory data is written to an XML document
2, analytical methods:
1 ", DOM:
The XML document added in one memory DOM tree form for easy CRUD, CRUD operations, but take up more memory. DOM tree tree-like diagram
2》,SAX:
XML documents progressive scan, does not account for memory, read only can not be deleted.
3, XML parser used:
1》JAXP
Sun provides the parser, SAX and DOM support in two ways
2 "Don4j
Excellent analytical tool
3 "Jsoup
Is a java HTML parser can parse URl directly, HTML content, it provides a set of API
4》PULL
Android Android operating system SAX parser way