XPath is a language used to search for information in XML documents. XPath can be used to traverse elements and attributes in XML documents.
XPath is the main element of W3C XSLT standards, and XQuery and XPointer are also built on XPath expressions.
We recommend a pretty good site: there are good examples in the http:
XPath is a language used to search for information in XML documents. XPath can be used to traverse elements and attributes in XML documents.
XPath is the main element of W3C XSLT standards, and XQuery and XPointer are also built on XPath expressions.
We recommend a pretty good site: there are good examples in the http:
Descendants are selected with spaces, such as a b{border:1px solid red;}A descendant selector, such as a>b{border:1px solid red;}But if you think about it, these two concepts are not a duplicate of the place,are descendants also descendants?are descendants not descendants?The relationship between the two is not discussed, so let's see what's different in CSS.First on the code:Descendant selector:Descendant selector:It can be said that the difference i
JQuery traversal element descendant and compatriot implementation method, jquery descendant
1. Traverse future generations
Children ()
The children () method returns all direct child elements of the selected element.
Find ()
The find () method returns the child element of the selected element, all the way down until the last child.
Selecter must be added to find (). If selecter is not added, it cannot be
corresponding data types in other programming languages, but the first data type is a unique product of the XML document tree.
XPath Node Type Because XPath contains a series of operations on the document structure tree, it is also necessary to understand the XPath node type. In the logical structure of an XML document, an XML file can contain elements, CDATA,
from Boolean types and string types.
The latter three types of data are similar to the corresponding data types in other programming languages, except that the first data type is a unique product of the XML document tree.
XPath node type
Because XPath contains a series of operations on the document tree, it is also necessary to know the XPath node type. In th
In XPath, there are seven types of nodes: elements, attributes, text, namespaces, processing commands, comments, and document nodes (or become root nodes ). In XPath, Node has seven types of nodes: elements, attributes, and text.
In XPath, there are seven types of nodes: elements, attributes, text, namespaces, processing commands, comments, and document nodes (or
root element, similar to the file system path (Unix), the path to/begins with the absolute path/root/child/: {Select the child node of the root node, the parent node (that is, root)Here are some common path expressions
NodeName Selecting a node with the name NodeName
/Select from root node
Select element descendant elements that must be followed by the NodeName
. Select the current node
.. Select the parent node of the curren
XPath Data Model
In the perspective of XPath, elements,Attributes, text, comments, processingInstructions or even namespacesAre 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
, Atomic values (text), processing commands, annotations, and root nodes (document nodes ), namespace and the relationship between nodes, such as: parent (parent), child (children), brother (sibling), advanced (ancestor), descendant (descendant) and other concepts have some understanding. It is not described here.
XPath path expression
In the content below this s
This time brings you the CSS descendant selector, the use of CSS descendants of the selection of considerations, the following is the actual case, together to see.
Descendant selectors are used to select all descendants of a label, including descendants and grandchildren, and the descendant selector selects only the descenda
PHP uses xpath to parse XML, and xpath to parse xml
This example describes how PHP parses XML using xpath. We will share this with you for your reference. The details are as follows:
XML files are widely used in lightweight applications developed by PHP websites. There are many ways for PHP to parse and read XML files, such as js dom, SimpleXml, and
']//parent::d IVUse the "parent" axis to match the 65 "div" nodes. If you want to focus on any particular element, then you can use the following XPath:xpath=//*[@id = ' rt-feature ']//parent::d iv[1]g) Self: Select the current node or "I" to indicate that it indicates the node itself, as shown in the following screen.Xpath =//*[@type = ' password ']//self::inputh) descendant: Selects all downlevel nodes of the current nodexpath=//*[@id = ' rt-featur
Descendant selectors are used to select all descendants of a label, including descendants and grandchildren, and the descendant selector selects only the descendant tag for the specified parent (the first generation of the tag element). This article mainly introduces the CSS selector of the descendant selector of the r
Sibling)
Nodes with the same parent
In the following example, the title, author, year, and price elements are all siblings:
Harry Potter J K. Rowling
2005
29.99
Advanced (Ancestor)
The parent and parent of a node.
In the following example, the first generation of the title element is the book element and the bookstore element:
Harry Potter J K. Rowling
2005
29.99
Descendant
Recursively obtain the descendant of a two-dimensional array and delete the descendant. # It is easy to use when there is little data # I don't know how to write non-recursive code, here, the non-recursive writing method is used ** to obtain the descendant * @ paramarray $ two-dimensional array to be operated by arr * @ paramint $ id the id to be obtained * @ par
A simple understanding of some basic methods for operating XPath in JavaScript, and how to operate xpath in javascript
Xpath is rarely used now, because JSON is very popular now. However, when XML was used as the data exchange format, Xpath played a very important role when we randomly accessed the large xml document s
Php + xml Programming: An xpath application instance. Php + xml programming-an xpath application example. This document describes the application of php + xml programming-xpath. Share it with you for your reference. Specifically: The xpath application example of php + xml programming in the core thinking of
all div and table nodes
Five, the XPath axisAxis can define a node set relative to the current node
Axis Name
An expression
Describe
Ancestor
XPath ('./ancestor::* ')
Selects all ancestor nodes of the current node (parent, grandfather)
Ancestor-or-self
XPath ('./ancestor-or-self::*
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.