XML and Xpath positioning Summary

Source: Internet
Author: User
1.1XML Introduction A typical XML document consists of the XML document header and the XML document body. XML Document Header: Contains ?? Tag. Example :? Xmlversion1.0encodingUTF-8? The XML document body. The data in the document is organized in a tree structure. A label leads to an element node.

1.1 XML Introduction A typical XML document consists of the XML document header and the XML document body. XML Document Header: contains? ? Tag. Example :? Xml version = "1.0" encoding = "UTF-8 "? The XML document body. The data in the document is organized in a tree structure. A label leads to an element node.

1.1 XML Introduction
A typical XML document consists of the XML document header and the XML document subject.
XML Document Header: Contains Tag. For example:

XML document body. The data in the document is organized in a tree structure. A tag leads to an element node. Attribute nodes can be specified in the element start tag, which is a Hong Kong server, it can also contain sub-elements and text content, or become an empty element without anything.
1. A correctly formatted XML document must consist of one and only one Header element. XML documents without root elements are called XML fragments.
2. Properly process special characters. Use CDATA segment:


%$#<>



In xml, you can also return a specified Node Set Based on filtering conditions.
1. Filter node sets based on attribute values
You can use the following representation to locate all ctor child elements under the class element:
/Class/Director
However, when you need to locate Director with the property id:
/Class/Director [@ id]
When you need to determine the attribute value:
/Class/Director [@ id = '000000']
2. Filter node sets by or expression
When you need to process multiple nodes with different names, you can use the | expression on the VM. For example, you need to locate the Name or Age in ctor and the Hong Kong Space. either of the two levels can be:
/Class/Director/Name | Age

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.