XML XPath Expressions

mac2022-06-30  36

XPath ExpressionsFollowing are some of the expressions that you can use to select one or more nodes from the XML document above:

/userinfo - Selects the root element. /userinfo/username - Selects the username node which is the child of userinfo root node. //email - Selects all the nodes in the document which match the name (email) irrespective of where they lie in the document. //username[@admin] - Selects all nodes with the name of "username" which have an attribute; "admin". /userinfo/username[1] - Selects the first username node that is the child of userinfo node. /userinfo/username[last()] - Assuming userinfo had more than one username child nodes, it will return the last username node that is the child of userinfo node.

 

相关文章:

Introduction to XML Reading XML Files with ASP.NET Introduction to XPath for ASP.NET Developers Creating new XML Document in ASP.NET Programmatically Introduction to DTD (Document Type Definition) Validating an XML Document using DTD in ASP.NET

转载于:https://www.cnblogs.com/fightLonely/archive/2010/05/21/1740951.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)