Lil Chopper Toy Title>
compact-disc>
items>
if Customer Is Not Available At The Address Then Attempt
Leave Package At One of the Following Locations Listed in Order Of
Which Should Be Attempted First First First
Next door html: li>
Front Desk html: li>
on DOORSTEP html: li>
html: ol>
Note html: b> Remember to Leave a Note Detailing Where
To Pick Up The Package.
html: p>
special-instructions>
order>
The beginning of the document is an optional XML declaration to specify the XML version used, then the character encoding used by the document. Next is an XML style table processing instruction to bind a style sheet. The formatting instruction of the XML document included in the style sheet can be used in a more vivid way to present an XML document in a user application (e.g., a web browser). Processing instructions are often used to embed an application-specific information in an XML document. For example, most applications that process the above documents ignore the XML style table processing instruction, and an application for displaying an XML document (e.g., a web browser) uses information in the processing instruction to determine that will contain it for display. The style sheet of the special instruction of the document is positioned.
Unicode angle bracket = interoperability
XML 1.0 syntax is based on text and can be easily analyzed, which makes XML become the preferred data exchange format when interacting with a platform. The XML analyzer can be used in a variety of commonly used operating systems, so the completely different components on different platforms can be easily standardized when needed, and XML is used as the exchange format.
The Unicode-based XML is also suitable for sharing information in a global network, such as on the web.
Infoset and XML series technologies Although the use of XML as data representation can bring a great advantage: obtaining platform interoperability and scalability by using text-based XML syntax, but this is only XML to develop One of the benefits brought about by personnel. Another main benefit using XML is that users can access various data processing, build, conversion, and query technology.
XML information set
The W3C XML Information SET recommends an abstract expression of an XML document. The XML information set is mainly used as a definition set of various XML technology to formally describe the XML document section that requires technical processing. Several W3C XML technology is described in XML information set, including SOAP 1.2, XML architecture, and xQuery.
The XML information set is a tree level representation of the XML document. An information set of an XML document contains many information items, which are abstract representations of XML document components, including representing documents, elements, attributes, processing instructions, comments, characters, representations, namespace, unsatisfactory entities. , Unlasting entity references and document type declaration information items. The XML information set is an officially recommended mechanism that defines important information that should be valued in the XML document. For example, the information set does not district two forms of emission elements. Therefore, according to the set of XML information, the following two representations
test>
Are the same. Similarly, the type type type used by the attribute is not important, so according to XML information set, element
Are the same. The XML information set is not important XML 1.0 syntax content list in Appendix D recommended by the W3C XML Information Set.
The XML Information SET recommendation introduces the concept of "Synthetic Infosets". The so-called integrated information set refers to the set of information created with other methods outside the XML documentation in the form of analysis text. The integrated information set has laid the foundation for the use of XML technology to deal with non-XML data. Of course, the premise is that such data can be mapped to the XML information set. One example of the integrated information set is ObjectxPathnavigator, which allows users to use XPath query objects in .NET Framework, or use XSLT conversion objects.
Architecture language
XML architectural languages are used to describe the structure and content of the XML document. For example, you can use the schema to specify a document that contain one or more Compact-Disc elements, while each Compact-DISC element contains sub-element Price, Title, and Artist. In the process of switching the document, the XML architecture can describe the agreement between the XML generating program and the usage program, as it describes the composition of the effective XML message between the two. Although there is a large number of architectural languages for XML, from DTD to XDR, now the most authoritative is the W3C XML architecture definition language, usually referred to as XSD.
XSD is unique in XML architectural languages because it tries to extend the role of the XML architecture so that it is no longer limited to use only to describe the two entities to exchange documents. XSD introduces the concept of "Post Schema Validation Infoset, PSVI". A complete XSD processor accepts the XML information set as an input and converts it to the Post Architecture Verification Information Set (PSVI) when verifying. PSVI is an initial input XML information set with new information that adds added and added to existing information items. W3C XML Schema recommends a component of the information set of the post-schema verification.
Type comments are a class of important classes in the PSVI component. Elements and attributes need to be strict type definitions and have data type information associated therewith. After a strict type defined XML, there are many purposes, you can use .NET Framework XMLSerializer and other technologies to map objects, you can use SQLXML and .NET Framework's DataSet technology to map them to relational forms, or use strict type mechanisms. XML query language, such as XPath 2.0 and XQuery processed it. The following example is an architecture fragment that describes the Items element of the sample document in the XML document.
xs: sequence>
xs: complexType>
xs: element>
xs: sequence>
xs: complexType>
xs: element>
xs: schema>
Tree model based API
Tree model API presented an XML document as a tree consisting of nodes, which can usually be loaded into memory immediately. The most commonly used XML tree model API is a W3C Document Object Model (DOM). DOM supports the XML documentation in programming, processing, and modify the XML document.
The following example uses the XMLDocument class in the .NET Framework to get the artist name and title of the first Compact-Disc in the Items element.
Using system;
USING SYSTEM.XML;
Public class test {
Public static void main (String [] args) {
XmLDocument Doc = New XmLDocument ();
Doc.Load ("Test.xml");
Xmlelement firstcd = (xmlelement) doc.documentelement.firstchild;
Xmlelement artist =
(XMLELEMENT) FIRSTCD.GETELEMENTSBYTAGNAME ("Artist") [0];
Xmlelement Title =
(XMLELEMENT) FIRSTCD.GETELEMENTSBYTAGNAME ("Title") [0]
Console.writeLine ("Artist = {0}, Title = {1}", Artist.innertext, Title.innertext);
}
Cursor-based API
The XML Cursor API is like moving in the XML document, and is aligned to all aspects of the directionally oriented document. The XPathnavigator class in .NET Framework is an XML cursor API. The XML Cursor API has the advantage of loading the entire document into memory than the tree model API, so that it is easy to optimize the part of the XML generated program.
The following example uses the XPathnavigator class in the .NET Framework to get the first Compact-Disc in the Items element, the first Compact-Disc in the iTems element.
Using system;
USING SYSTEM.XML;
Using system.xml.xpath;
Public class test {
Public static void main (String [] args) {
XmLDocument Doc = New XmLDocument ();
Doc.Load ("Test.xml");
Xpathnavigator NAV = doc.createnavigator ();
Nav.movetofirstchild (); // Move from root nodes to document elements (items)
nav.movetofirstchild (); // From the items element to the first Compact-Disc element
/ / From Compact-Disc elements to Artist elements
nav.movetofirstchild ();
nav.movetonext ();
String artist = nav.value;
/ / From the Artist element to the Title element
nav.movetonext ();
String title = nav.value;
Console.writeline ("Artist = {0}, Title = {1}", Artist, Title;
}
}
Flow API
When using a streaming API of the XML, the user only needs to store the context of the current node to process in the memory, the XML document can be processed. Such APIs can handle large XML files without occupying huge content space. The streaming API for XML processes mainly has two types: based on the advanced XML analyzer and the pull-out XML analyzer.
The advancement of the promoted analyzer (such as SAX) is to move in the XML data stream, and the event "advance" to the registered event handler (callback method) when encountering an XML node. Based on the pull-out parser (such as the XMLReader class in .NET Framework) used as a forward cursor in the XML data stream.
The following example uses the XMLReader class in the .NET Framework to get the artist name and title of the first Compact-Disc in the Items element.
Using system;
USING SYSTEM.XML;
Public class test {
Public static void main (String [] args) {
String artist = null, title = null;
XMLTextReader Reader = New XMLTextReader ("Test.xml");
Reader.moveTocontent (); //move from root node to document element (item)
/ * Keep read until you get the first element * / while (Reader.Read ()) {
IF ((Reader.NodeType == XMLNodeType.element) && reader.name.equals ("artist")) {
Artist = Reader.Readelementstring ();
Title = Reader.ReadeElementstring ();
Break;
}
}
Console.writeline ("Artist = {0}, Title = {1}", Artist, Title;
}
}
XML query
In some cases, using the API from the XML document will be too cumbersome, this or because the conditions of the lookup data are too simple, or because the API does not present specific content for the XML document for a particular query. The XML query language (such as XPath 1.0 and the upcoming XQuery) provide a rich mechanism for extracting information from XML information.
The following example shows how to use XPath to get the artist name and title of the first Compact-Disc in the Items element.
Using system;
Using system.xml.xpath;
Public class test {
Public static void main (String [] args) {
XpathDocument Doc = New XpathDocument ("Test.xml");
Xpathnavigator NAV = doc.createnavigator ();
XpathNodeIterator ity = nav.select ("/ items / compact-disc [1] / artist | / items / compact-disc [1] / title");
Iterator.movenext ();
Console.writeLine ("Artist = {0}", Iterator.current);
Iterator.movenext ();
Console.writeline ("Title = {0}", Iterator.current);
}
}
XML conversion
Users often need to convert an XML document from one vocabulary to another vocabulary. This is sometimes intended to be in order to printed a format or presentation document in a web browser, sometimes it may need to convert documents received from an external entity into a more familiar format.
XSLT is an excellent XML conversion language. The conversion set forth in XSLT illustrates the rules that convert the source tree into the results tree. Conversion is done by association mode and template. A mode is an XPath expression that can be considered as a regular expression that matches the portion of the XML source tree, which is opposite to the matching portion of the string. The mode matches the elements in the source tree. After successful match, the template becomes an exemplary example of the creation of the results tree. When building a result tree, you can filter and reorder the elements in the source tree, and any configuration can be added.
The following XSLT style sheet converts the items element to the XHTML web page containing the CD.
DOCTYPE-System = "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transition.dtd" DOCTYPE-PUBLIC = "- // W3C // DTD XHTML 1.0 Transitional // En" />
Order Information - ORD123456 Title>
hEAD>