com.taleo.integration.client.customstep.util.xml
Class SimpleNamespaceContext

java.lang.Object
  extended by com.taleo.integration.client.customstep.util.xml.SimpleNamespaceContext
All Implemented Interfaces:
javax.xml.namespace.NamespaceContext

public class SimpleNamespaceContext
extends java.lang.Object
implements javax.xml.namespace.NamespaceContext

Implementation of NamespaceContext that introspect an XML fragment to collect the namespaces it contains.

Author:
Romain Guay - Taleo Corporation

Constructor Summary
SimpleNamespaceContext(java.io.InputStream xml)
          Constructor with the XML fragment.
SimpleNamespaceContext(java.io.InputStream xml, java.lang.String defaultNamespacePrefix)
          Constructor with the XML fragment and the default namespace prefix.
 
Method Summary
 java.lang.String getNamespaceURI(java.lang.String prefix)
           
 java.lang.String getPrefix(java.lang.String uri)
           
 java.util.Iterator getPrefixes(java.lang.String uri)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleNamespaceContext

public SimpleNamespaceContext(java.io.InputStream xml)
Constructor with the XML fragment.

Note that this namespace context cannot be used to resolve XPath expressions that use elements in the default namespace.

Parameters:
xml - The XML fragment as an InputStream.

SimpleNamespaceContext

public SimpleNamespaceContext(java.io.InputStream xml,
                              java.lang.String defaultNamespacePrefix)
Constructor with the XML fragment and the default namespace prefix.

Allows to set an explicit prefix for the default namespace. This is useful because XPathExpression evaluation does not work with the default namespace. This prefix can then be used in the XPath expression to evaluate instead of no namespace prefix.

Parameters:
xml - The XML fragment as an InputStream.
defaultNamespacePrefix - The substitute prefix to use for the default namespace.
Method Detail

getNamespaceURI

public java.lang.String getNamespaceURI(java.lang.String prefix)
Specified by:
getNamespaceURI in interface javax.xml.namespace.NamespaceContext

getPrefix

public java.lang.String getPrefix(java.lang.String uri)
Specified by:
getPrefix in interface javax.xml.namespace.NamespaceContext

getPrefixes

public java.util.Iterator getPrefixes(java.lang.String uri)
Specified by:
getPrefixes in interface javax.xml.namespace.NamespaceContext