📄 xpath-find.xtp
字号:
<s1 title="XPath find()"><p>XPath is a language for selecting XML nodes. It was originally part of theXSLT spec, but was split out because the W3C realized XPath was usefulby itself.</p><p>In Resin, you can use <var/XPath.find()/> to find a node from an XML DOMdata structure.</p><def>XPath.find(String pattern, Node node)</def><p>The first example finds the first <b> in the tree.</p><example title='test.xml'><top> <a id='1'> <b id='2'/> </a> <b id='3'/> <c id='4'/></top></example><example>import org.w3c.dom.*;import com.caucho.xml.*;import com.caucho.xpath.*;...Document doc = new Xml().parseDocument("test.xml");Element elt = (Element) XPath.find("b", doc);System.out.println("Node: " + elt.getNodeName());System.out.println("id: " + elt.getAttribute("id"));</example><results>Node: bid: 2</results><s2 title="Summary"><ul><li><var/XPath/> is a language for selecting XML nodes<li><var/XPath.find()/> returns the first matching node<li>XPath searches in <var/document order/><li>The pattern <var/b/> matches any element <var/<b>/></ul></s2></s1>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -