NetKernel APIs


org.ten60.netkernel.xml.xda
Class DOMPrefixResolver

java.lang.Object
  extended byorg.ten60.netkernel.xml.xda.DOMPrefixResolver
All Implemented Interfaces:
org.apache.xml.utils.PrefixResolver

public class DOMPrefixResolver
extends Object
implements org.apache.xml.utils.PrefixResolver

A PrefixResolver that works with with namespaces and is cacheable


Nested Class Summary
 class DOMPrefixResolver.MapItem
           
 
Field Summary
static String XML_PREFIX
           
static String XML_PREFIX_NAMESPACE
           
 
Constructor Summary
DOMPrefixResolver()
          Creates a new instance of DOMPrefixResolver
DOMPrefixResolver(Document aDocument)
          Creates a new instance of WritablePrefixResolver
 
Method Summary
 String getBaseIdentifier()
          Return the base identifier.
 String getNamespaceForPrefix(String aPrefix)
          Given a namespace, get the corrisponding prefix.
 String getNamespaceForPrefix(String prefix, Node context)
          Given a namespace, get the corresponding prefix, based on the context node.
 Map getPrefixMap()
           
 boolean handlesNullPrefixes()
           
 boolean hasNamespaces()
           
 void setBaseIdentifier(String aString)
           
 void setNamespaceforPrefix(String aPrefix, String aUri)
           
 void setNamespaceforPrefix(String aPrefix, String aUri, Node aContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_PREFIX

public static final String XML_PREFIX
See Also:
Constant Field Values

XML_PREFIX_NAMESPACE

public static final String XML_PREFIX_NAMESPACE
See Also:
Constant Field Values
Constructor Detail

DOMPrefixResolver

public DOMPrefixResolver(Document aDocument)
Creates a new instance of WritablePrefixResolver


DOMPrefixResolver

public DOMPrefixResolver()
Creates a new instance of DOMPrefixResolver

Method Detail

getBaseIdentifier

public String getBaseIdentifier()
Return the base identifier.

Specified by:
getBaseIdentifier in interface org.apache.xml.utils.PrefixResolver
Returns:
The base identifier from where relative URIs should be absolutized, or null if the base ID is unknown.

CAVEAT: Note that the base URI in an XML document may vary with where you are in the document, if part of the doc's contents were brought in via an external entity reference or if mechanisms such as xml:base have been used. Unless this PrefixResolver is bound to a specific portion of the document, or has been kept up to date via some other mechanism, it may not accurately reflect that context information.


getNamespaceForPrefix

public String getNamespaceForPrefix(String aPrefix)
Given a namespace, get the corrisponding prefix. This assumes that the PrefixResolver holds its own namespace context, or is a namespace context itself.

Specified by:
getNamespaceForPrefix in interface org.apache.xml.utils.PrefixResolver
Returns:
The associated Namespace URI, or null if the prefix is undeclared in this context.

getNamespaceForPrefix

public String getNamespaceForPrefix(String prefix,
                                    Node context)
Given a namespace, get the corresponding prefix, based on the context node.

Specified by:
getNamespaceForPrefix in interface org.apache.xml.utils.PrefixResolver
Parameters:
prefix - The prefix to look up, which may be an empty string ("") for the default Namespace.
context - The node context from which to look up the URI.
Returns:
The associated Namespace URI as a string, or null if the prefix is undeclared in this context.

handlesNullPrefixes

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

setBaseIdentifier

public void setBaseIdentifier(String aString)

setNamespaceforPrefix

public void setNamespaceforPrefix(String aPrefix,
                                  String aUri)

setNamespaceforPrefix

public void setNamespaceforPrefix(String aPrefix,
                                  String aUri,
                                  Node aContext)

hasNamespaces

public final boolean hasNamespaces()

getPrefixMap

public Map getPrefixMap()

NetKernel APIs


Copyright © 2002-2004 1060 Research Ltd. All Rights Reserved.