nl.surfnet.coin.portal.util
Class XPathUtil

java.lang.Object
  extended by nl.surfnet.coin.portal.util.XPathUtil

public class XPathUtil
extends Object


Constructor Summary
XPathUtil()
          Constructor
 
Method Summary
 Node getNode(Node startNode, Map<String,String> namespaces, String xPathStr)
          Returns a single Node for the given xpath under a Node
 NodeList getNodes(InputStream in, Map<String,String> namespaces, String xPathStr)
          Parses an InputStream and returns a NodeList of the given xpath
 NodeList getNodes(Node startNode, Map<String,String> namespaces, String xPathStr)
          Returns a NodeList for the given xpath under a Node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathUtil

public XPathUtil()
Constructor

Method Detail

getNodes

public NodeList getNodes(InputStream in,
                         Map<String,String> namespaces,
                         String xPathStr)
                  throws IOException,
                         SAXException,
                         ParserConfigurationException,
                         XPathExpressionException
Parses an InputStream and returns a NodeList of the given xpath

Parameters:
in - the InputStream of the XML structure
namespaces - Map of namespaces
xPathStr - String with the xpath expression
Returns:
NodeList that is the result of the xpath expression
Throws:
IOException - if the input cannot be read
SAXException - if the input is malformed XML
ParserConfigurationException
XPathExpressionException - in case of an invalid xpath

getNodes

public NodeList getNodes(Node startNode,
                         Map<String,String> namespaces,
                         String xPathStr)
                  throws XPathExpressionException
Returns a NodeList for the given xpath under a Node

Parameters:
startNode - the Node that is the root of the xpath
namespaces - Map of namespaces
xPathStr - String with the xpath expression
Returns:
NodeList that is the result of the xpath expression
Throws:
XPathExpressionException - in case of an invalid xpath

getNode

public Node getNode(Node startNode,
                    Map<String,String> namespaces,
                    String xPathStr)
             throws XPathExpressionException
Returns a single Node for the given xpath under a Node

Parameters:
startNode - the Node that is the root of the xpath
namespaces - Map of namespaces
xPathStr - String with the xpath expression
Returns:
Node that is the result of the xpath expression
Throws:
XPathExpressionException - in case of an invalid xpath


Copyright © 2009-2012 SURFnet bv, The Netherlands. All Rights Reserved.