XPath learning notes XPath Data Model

Source: Internet
Author: User
XPath Data Model

In the perspective of XPath, elements,
Attributes, text, comments, processing
Instructions or even namespaces
Are represented by nodes associated with each other in the tree structure. Some nodes, such as elements, can have subnodes, but some cannot. For example, attributes cannot have subnodes according to XML specifications. The root node is the ultimate parent node.

Each node exposes its attributes to XPath in different ways:

  • A name. some nodes, such as the root node, the remarks and text node names are always empty strings "". elements and attributes have extended names: local name plus namespace URI. processing Instructions uses the "target" that is not affected by namespace processing as the name. the namespace node uses the prefix as the name.
  • A text node in a string value. xml source contains text characters
  • A string value. text nodes contain the text characters from
    Source XML, with line endings normalized to # XA as required by the XML specification. Text
    Nodes will always contain as much text as possible, and, thus, no two
    Consecutive children will ever both be text nodes and the location of CDATA
    Sections is not preserved. Comment nodes
    Contain the full text of the comment (minus
    <! --And
    -->Delimiters). Attributes contain the attribute value, and processing instructions contain the text after
    The initial target and whitespace, and up to and not including the terminating
    ?>. Namespace nodes contain a URI (or the empty
    String) as a name. The root node and Element
    Nodes compute their string value by recursively concatenating the string values
    Of all descendant nodes.

  • Children. In theory, you can ask about children
    Of any node, but only the root node and element nodes will actually have
    Children.

  • A position relative to all other nodes.
    Overall ordering is called the document order.

Alas... I am tired. I am still able to read English directly.

 

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.