An XPath path expressionXPath uses a path expression to pick a node or set of nodes in an XML document. These path expressions are very similar to the expressions we see in the regular computer file system. A node is picked up either along a path or a step (steps).NodeIn XPath, there are seven types of nodes: elements, attributes, text, namespaces, processing directives, annotations, and document (root) nodes. The XML document is treated as a node tree. The root of a tree is called a document no
absolute path, such as Step/step, which is not using the "/" first.# "." Represents the current node.# ".." Represents the parent node of the current node two, the basic rules of the selection node
-NodeName (node name): Indicates that all child nodes of the node are selected-"/": means to select the root node-"//": Indicates that a node is selected anywhere-"@": indicates that a property is selected
Third, select the instance of the node
Look at an XML instance document first.
[Example 1]
using XPath to find the need to introduce Jaxen-xx-xx.jar, otherwise it will report java.lang.noclassdeffounderror:org/jaxen/jaxenexception exception.
List list=document. selectnodes ("/books/book/@show"); XPath Syntax 1, select the node
XPath uses a path expression to select a node in an XML document, and the node is selected along the path or step.
Common Path Expressions:
An expression
Description
NodeName
Select all child nodes of the current node
Tags: package store www based on ref find Lang ASP wildcardDirectory
1. Installing Xpath
2, XPath basic use
3. XPath syntax
3.1. Commonly used path expressions
3.2. Finding specific elements based on predicates
3.3. Wildcard characters
3.4. Select multiple paths
1. Installing Xpathpip install lxml2, XPath basic usefrom lxml import etree
html = ‘‘‘
3. XPath syntax 3.1, commonly used path expressions
An expression
Desc
attributes
Example
RESTful Web Services
29.00
C # Programming basics
46.00
Resolution:
Bookstore
Select all subnodes of the bookstore element
/Bookstore
Select the root node bookstore elem
the current node.
@
Select the attribute.
InstanceIn the table below, we have listed some path expressions and the results of the expressions:
Path Expression
Results
Bookstore
Selects all child nodes of the bookstore element.
/bookstore
Select the root element bookstore.
of STL documentation http://www.ge.infn.it/geant4/training/stl.html
Links to proposals for introducing parameterized types into JavaHttp://www.inf.fu-berlin.de /~ Bokoski/pmgjava/proposals.html
Java
Search Java2 SDK v1.3 documentation http://java.sun.com/j2se/1.3/search.html
Http://java.sun.com/j2se/5.0/search.html for search Java2 SDK V5.0 documentation
Popular Java IDE, eclipse http://www.eclipse.org
Design Techniques-articles about JavaProgram Design by Bill VennersHttp://www.artima.c
the integrity constraints that the relational model must satisfy in order to ensure the consistency of the data. MySQL Database MySQL is a relational database management system developed by the Swedish MySQL AB company, currently owned by Oracle Corporation. MySQL is an associated database management system that keeps data in separate tables rather than putting all of the data in a large warehouse, which increases speed and increases flexibility. 1.Mysql is open source, so you don't have to
Original: Interpretation of ASP. 5 MVC6 Series (3): Project Release and deploymentIn this chapter we will talk about the ASP.NET5 Project release deployment, which is an example of the bookstore project created in our previous chapter.Pre-release settingsSince the new ASP.NET5 supports the release and deployment of multiple versions of the DNX runtime environment, we need to set the target DNX of the deployment (that is, the previous kre) before depl
current node.# ".." Represents the parent node of the current nodeIi. basic rules for selecting nodes-NodeName (node name): Indicates that all child nodes of the node are selected-"/": Indicates select root node-"//": Indicates that a node is selected anywhere-"@": Indicates the selection of a propertyIii. examples of selecting nodesLet's look at an XML instance document:XML version= "1.0" encoding= "Iso-8859-1"?>Bookstore> Book> titleLang= "Eng
, namespace, processing instruction, comment, and document node (or root node). The root node of the document is the document node, the corresponding attribute has the attribute node, and the element has the element node.
ii. Common path expressionsDescription of expression
NodeName Select all child nodes of this node
/Select from root node
Select the nodes in the document from the current node of the matching selection, regardless of their location
. Select the current node
.. Select the pare
compatriots.Ancestors (ancestor)In Example 1, the ancestor of the title element is the book element and the bookstore element.Descendants (descendant)In Example 1, the descendants of the bookstore element are the book, title, author, year, and price elements.XPath uses a path expression to pick a node or set of nodes in an XML document. A node is picked up either along a path or a step (steps).XML Instance
document (Root) nodes. XML documents are treated as node trees. The root of a tree is called a document node or a root node.
See the following XML document:
Node example in the XML document above:
Lang = "en" (attribute node)
Basic value (or Atomic value)
The basic value is a node with no parent or child.
Example of the basic value:
Beijing
"Chinese"
Item)
A project is a basic value or node.
Node relationship
Parent)
Each element and attribute has a parent.
In the fo
using XPath to find the need to introduce Jaxen-xx-xx.jar, otherwise it will report java.lang.noclassdeffounderror:org/jaxen/jaxenexception exception. List list=document. selectnodes ("/books/book/@show");XPath syntax 1, selecting nodesXPath uses a path expression to select a node in an XML document, and the node is selected along a path or step.Common Path Expressions:
An expression
Describe
NodeName
Selects all child nodes of the current node
the nodes in the document from the current node of the matching selection, regardless of their location
.
Select the current node
..
Select the parent node of the current node
@
Select Properties
wildcard characters
Describe
*
Match any element node
@*
Match any attribute node
Node ()
Match any type of node
|
Select several paths
Iv. examples
D
Address: http://blog.csdn.net/wind19/archive/2009/11/30/4905453.aspx
My testing environment is SuSE Linux 10.1.
Keep CT home page: http://expect.nist.gov/Latest stable version 5.45.0: http://sourceforge.net/projects/expect/files/Expect/5.45/expect5.45.tar.gz/download
Secondary CT depends on Tcl/tk, so install Tcl/tk before installing secondary CT.
Download Page of
expressions and expression results:
Path expression
Result
Bookstore
Select All subnodes of the bookstore Element
/Bookstore
Select the root element bookstore Note: If the path starts with a forward slash (/), the path always represents the absolute path t
selected node, regardless of their location.
.
Select the current node.
..
Select the parent node of the current node.
@
Select attributes.
Instance
In the following table, we have listed some path expressions and expression results:
Path expression
Result
Bookstore
Select All subnodes of the bookstore element.
/
Xmldocument xmldoc = new xmldocument ();
Xmldoc. Load ("Bookstore. xml ");
// Xmldoc. loadxml ("
Xmlnode root = xmldoc. selectsinglenode ("Bookstore"); // query
Xmlelement xe1 = xmldoc. createelement ("book"); // create a
Xe1.setattribute ("genre", "lizan red"); // you can specify the genre attribute of the node.
Xe1.setattribute ("ISBN", "2-3631-4"); // you can specify the ISBN attribute of the nod
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.