a repository for materials related to teaching and writing on technologies of up-conversion and project development with the XML family of languages, featuring regex, XPath, XQuery, XSLT, and Schematron.
// create the JAXP XPath evaluation environment.
XPath xpath = XPathFactory.newInstance().newXPath();
// creat an xpath expression. This example select all nodes with the
// name 'link' from the root of the document.
String expression = "//link";
// get a list of nodes using the xpath environment, DOM Document and the
// XPath expression. Specify the type of node that is retrived (in this
// case its a NODESET which is a list of nodes)
NodeList linkNodes = (NodeList) xpath.evaluate(expression, bbcDoc, XPathConstants.NODESET);
for (int i = 0; i < linkNodes.getLength(); i++) {
// System.out.println(linkNodes.item(i).getTextContent());
}
Update: Minor correction in the last two rows of the table -- thanks to a comment by Michael Ludwig. I will talk about the efficiency of this and other related XPath expressions in my next post. In my first post I provided a compact one-liner XPath expression that obtains all duplicate items in a given…
XPath 1.0 Tutorial with indexes: Pages(23 items) and Keywords(34 items); language for addressing parts of XML documents in XSLT 1.0 providing as well basic facilities for manipulation of strings, numbers and booleans
R. Agrawal, J. Kiernan, R. Srikant, and Y. Xu. WWW '03: Proceedings of the 12th international conference on World Wide Web, page 629--639. New York, NY, USA, ACM, (2003)
R. Vercammen, J. Hidders, and J. Paredaens. Proc. of the 2nd International Workshop on Database Technologies for Handling XML Information on the Web (DataX 2006), 4254, page 250--263. Munich, Germany, (2006)