XML Security, 1.6

com.ibm.xml.enc.dom
Class PrefixResolverImpl

java.lang.Object
  extended by com.ibm.xml.enc.dom.PrefixResolverImpl
All Implemented Interfaces:
org.apache.xml.utils.PrefixResolver

public class PrefixResolverImpl
extends java.lang.Object
implements org.apache.xml.utils.PrefixResolver

This class implements a generic PrefixResolver that can be used to perform prefix-to-namespace lookup for the XPath object.


Field Summary
(package private)  org.w3c.dom.Node m_context
          The context to resolve the prefix from, if the context is not given.
(package private)  java.util.Map nsmap
           
 
Constructor Summary
PrefixResolverImpl(org.w3c.dom.Node xpathExpressionContext)
          Construct a PrefixResolverDefault object.
 
Method Summary
 java.lang.String getBaseIdentifier()
          Return the base identifier.
 java.lang.String getNamespaceForPrefix(java.lang.String prefix)
          Given a namespace, get the corrisponding prefix.
 java.lang.String getNamespaceForPrefix(java.lang.String prefix, org.w3c.dom.Node namespaceContext)
          Given a namespace, get the corrisponding prefix.
 boolean handlesNullPrefixes()
           
 void setNamespaceMap(java.util.Map map)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_context

org.w3c.dom.Node m_context
The context to resolve the prefix from, if the context is not given.


nsmap

java.util.Map nsmap
Constructor Detail

PrefixResolverImpl

public PrefixResolverImpl(org.w3c.dom.Node xpathExpressionContext)
Construct a PrefixResolverDefault object.

Parameters:
xpathExpressionContext - The context from which XPath expression prefixes will be resolved. Warning: This will not work correctly if xpathExpressionContext is an attribute node.
xpathExpressionContext - Node from which to start searching for a xmlns attribute that binds a prefix to a namespace (when the namespace context is not specified in the getNamespaceForPrefix call).
Method Detail

setNamespaceMap

public void setNamespaceMap(java.util.Map map)

getNamespaceForPrefix

public java.lang.String getNamespaceForPrefix(java.lang.String prefix)
Given a namespace, get the corrisponding prefix. This assumes that the PrevixResolver hold's it's own namespace context, or is a namespace context itself.

Specified by:
getNamespaceForPrefix in interface org.apache.xml.utils.PrefixResolver
Parameters:
prefix - Prefix to resolve.
Returns:
Namespace that prefix resolves to, or null if prefix is not bound.

getNamespaceForPrefix

public java.lang.String getNamespaceForPrefix(java.lang.String prefix,
                                              org.w3c.dom.Node namespaceContext)
Given a namespace, get the corrisponding prefix. Warning: This will not work correctly if namespaceContext is an attribute node.

Specified by:
getNamespaceForPrefix in interface org.apache.xml.utils.PrefixResolver
Parameters:
prefix - Prefix to resolve.
namespaceContext - Node from which to start searching for a xmlns attribute that binds a prefix to a namespace.
Returns:
Namespace that prefix resolves to, or null if prefix is not bound.

getBaseIdentifier

public java.lang.String getBaseIdentifier()
Return the base identifier.

Specified by:
getBaseIdentifier in interface org.apache.xml.utils.PrefixResolver
Returns:
null

handlesNullPrefixes

public boolean handlesNullPrefixes()
Specified by:
handlesNullPrefixes in interface org.apache.xml.utils.PrefixResolver
See Also:
PrefixResolver.handlesNullPrefixes()

XML Security, 1.6

Portions Copyright 2003, 2012 IBM Corporation.
Portions Copyright 2003, 2012 Oracle and/or its affiliates.