org.n52.security.common.xml
Class XMLPathCtx

java.lang.Object
  extended by org.n52.security.common.xml.XMLPathCtx

public class XMLPathCtx
extends java.lang.Object

Class XMLPathCtx encapsulates context informations for xpath expressions.

Use this class to create new XMLPath objectes and combinations of them.

This class wraps the javax.xml.xpath package with performance improvments and simpler useage.

Version:
$Revision: $
Author:
Marko Reiprecht Created on 15.07.2008

Constructor Summary
protected XMLPathCtx(org.n52.security.common.xml.XMLPathCtx.XPathPool xPathPool)
          Constructor creates a new instance.
 
Method Summary
 XMLPathCtx addNamespace(java.lang.String prefix, java.lang.String namespace)
          Method adds prefix to namespace mapping, so the prefix can be used to qualify xpath expressions.
static XMLPathCtx createNew()
          Method creates a new XMLPathCtx instance.
 XMLPath findIn(org.w3c.dom.Document doc)
          Method findIn constructs a new XMLPath starting in a Document source.
 XMLPath findIn(org.xml.sax.InputSource source)
          Method findIn constructs a new XMLPath starting in a InputSource source.
 XMLPath findIn(org.w3c.dom.Node node)
          Method findIn constructs a new XMLPath starting in a Node source.
 XMLPath findIn(org.w3c.dom.NodeList nodeList)
          Method findIn constructs a new XMLPath starting in a NodeList source.
 XMLPath findIn(java.lang.String source)
          Method findIn constructs a new XMLPath starting in a string source.
protected  javax.xml.xpath.XPathExpression lookUp(java.lang.String xpath)
          Method looks up an XPathExpression.
 XMLPathCtx register(java.lang.String xpath)
          Method registers an xpath as precompiled XPathExpression.
 XMLPathCtx register(java.lang.String name, java.lang.String xpath)
          Method registers an xpath as precompiled XPathExpression with a special name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLPathCtx

protected XMLPathCtx(org.n52.security.common.xml.XMLPathCtx.XPathPool xPathPool)
Constructor creates a new instance.

Parameters:
xPathPool - the xPathPool.
Method Detail

addNamespace

public XMLPathCtx addNamespace(java.lang.String prefix,
                               java.lang.String namespace)
Method adds prefix to namespace mapping, so the prefix can be used to qualify xpath expressions.

Parameters:
prefix - the prefix.
namespace - the namespace.
Returns:
XMLPathCtx.

createNew

public static XMLPathCtx createNew()
Method creates a new XMLPathCtx instance. The instance uses the internaly xpath instance pool.

Returns:
XMLPathCtx.

findIn

public XMLPath findIn(org.w3c.dom.Document doc)
Method findIn constructs a new XMLPath starting in a Document source.

Parameters:
doc - the doc.
Returns:
XMLPath.

findIn

public XMLPath findIn(org.w3c.dom.Node node)
Method findIn constructs a new XMLPath starting in a Node source.

Parameters:
node - the node.
Returns:
XMLPath.

findIn

public XMLPath findIn(org.w3c.dom.NodeList nodeList)
Method findIn constructs a new XMLPath starting in a NodeList source.

Parameters:
nodeList - the nodeList.
Returns:
XMLPath.

findIn

public XMLPath findIn(org.xml.sax.InputSource source)
Method findIn constructs a new XMLPath starting in a InputSource source.

Parameters:
source - the source.
Returns:
XMLPath.

findIn

public XMLPath findIn(java.lang.String source)
Method findIn constructs a new XMLPath starting in a string source.

Parameters:
source - the source.
Returns:
XMLPath.

lookUp

protected javax.xml.xpath.XPathExpression lookUp(java.lang.String xpath)
Method looks up an XPathExpression. A XPathExpression can be precompiled by using the register mehtods.

Parameters:
xpath - the xpath.
Returns:
XPathExpression.

register

public XMLPathCtx register(java.lang.String xpath)
Method registers an xpath as precompiled XPathExpression.

Parameters:
xpath - the xpath.
Returns:
XMLPathCtx.

register

public XMLPathCtx register(java.lang.String name,
                           java.lang.String xpath)
Method registers an xpath as precompiled XPathExpression with a special name.

After that you can use the name when ever an xpath is needed.

Parameters:
name - the name.
xpath - the xpath.
Returns:
XMLPathCtx.


Copyright © 2004-2009 52north.org. All Rights Reserved.