Version: 1.1.1

org.biomoby.shared
Class MobyPrefixResolver

java.lang.Object
  extended by org.biomoby.shared.MobyPrefixResolver
All Implemented Interfaces:
org.apache.xml.utils.PrefixResolver

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

The main purpose of this class is to provide default mapping from prefices we will use in the XPath statements built in the various client classes to URI's of XML namespaces. For example, if one wanted to construct a XPath statement looking for queryResponse elements from the MOBY namespace, there is no direct mechanism to specify this in the XPath. One can instead compile an XPath statement such as "//moby:queryResponse" and use this PrefixResolver, that defines the "moby" prefix as pointing to the MOBY XML Namespace. Otherwise the "//moby:queryResponse" will not match the document unless the document happens to use "moby:" as that Namespace's prefix. Using this class is the only way to compile XPaths that are independent of the namespace declarations in the document (since those are the default ones used by XPath evaluators). NOTE: the methods of this class rely on the DOM being parsed with a namespace-aware parser!


Nested Class Summary
static class MobyPrefixResolver.MobyNodeList
           
 
Field Summary
static String DUBLIN_CORE_NAMESPACE
           
static String DUBLIN_CORE_PREFIX
           
static String HTTP_NAMESPACE
           
static String HTTP_PREFIX
           
static String LSID_NAMESPACE
           
static String LSID_PREFIX
           
static String MOBY_TRANSPORT_NAMESPACE
           
static String MOBY_TRANSPORT_PREFIX
           
static String MOBY_XML_NAMESPACE
           
static String MOBY_XML_NAMESPACE_INVALID
           
static String MOBY_XML_PREFIX
           
static String SAWSDL_NAMESPACE
           
static String SAWSDL_PREFIX
           
static String SOAP_ENC_NAMESPACE
           
static String SOAP_ENC_PREFIX
           
static String WS_ADDRESSING_NAMESPACE
           
static String WS_ADDRESSING_PREFIX
           
static String WSDL_NAMESPACE
           
static String WSDL_PREFIX
           
static String WSDL20_NAMESPACE
           
static String WSDL20_PREFIX
           
static String WSRP_NAMESPACE
           
static String WSRP_PREFIX
           
static String XHTML_NAMESPACE
           
static String XHTML_PREFIX
           
static String XLINK_NAMESPACE
           
static String XLINK_PREFIX
           
static String XSD_NAMESPACE
           
static String XSD_PREFIX
           
static String XSI_NAMESPACE1999
           
static String XSI_NAMESPACE2001
           
static String XSI_PREFIX
           
static String XSI1999_PREFIX
           
static String XSI2001_PREFIX
           
 
Constructor Summary
MobyPrefixResolver()
           
 
Method Summary
static String getAttr(Element e, String attrName)
          Convenience method that matches attributes in the MOBY namespace or, for now at least, with no declared namespace.
 String getBaseIdentifier()
          We don't really implement this as it can be extremely complicated.
static Element getChildElement(Element e, String elementName)
          Convenience method that matches attributes in the MOBY namespace or, for now at least, with no declared namespace.
static NodeList getChildElements(Element e, String elementName)
          Convenience method that matches child elements in the MOBY namespace or, for now at least, with no declared namespace. "*" acts as a wildcard.
 String getNamespaceForPrefix(String prefix)
           
 String getNamespaceForPrefix(String prefix, Node context)
          Don't use this class if this method will be used.
 boolean handlesNullPrefixes()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MOBY_XML_NAMESPACE

public static final String MOBY_XML_NAMESPACE
See Also:
Constant Field Values

MOBY_XML_NAMESPACE_INVALID

public static final String MOBY_XML_NAMESPACE_INVALID
See Also:
Constant Field Values

MOBY_XML_PREFIX

public static final String MOBY_XML_PREFIX
See Also:
Constant Field Values

MOBY_TRANSPORT_NAMESPACE

public static final String MOBY_TRANSPORT_NAMESPACE
See Also:
Constant Field Values

MOBY_TRANSPORT_PREFIX

public static final String MOBY_TRANSPORT_PREFIX
See Also:
Constant Field Values

XSI_NAMESPACE1999

public static final String XSI_NAMESPACE1999
See Also:
Constant Field Values

XSI_NAMESPACE2001

public static final String XSI_NAMESPACE2001
See Also:
Constant Field Values

XSI_PREFIX

public static final String XSI_PREFIX
See Also:
Constant Field Values

XSI1999_PREFIX

public static final String XSI1999_PREFIX
See Also:
Constant Field Values

XSI2001_PREFIX

public static final String XSI2001_PREFIX
See Also:
Constant Field Values

XSD_NAMESPACE

public static final String XSD_NAMESPACE
See Also:
Constant Field Values

XSD_PREFIX

public static final String XSD_PREFIX
See Also:
Constant Field Values

SOAP_ENC_NAMESPACE

public static final String SOAP_ENC_NAMESPACE
See Also:
Constant Field Values

SOAP_ENC_PREFIX

public static final String SOAP_ENC_PREFIX
See Also:
Constant Field Values

WS_ADDRESSING_PREFIX

public static final String WS_ADDRESSING_PREFIX
See Also:
Constant Field Values

WS_ADDRESSING_NAMESPACE

public static final String WS_ADDRESSING_NAMESPACE
See Also:
Constant Field Values

WSRP_PREFIX

public static final String WSRP_PREFIX
See Also:
Constant Field Values

WSRP_NAMESPACE

public static final String WSRP_NAMESPACE
See Also:
Constant Field Values

XHTML_PREFIX

public static final String XHTML_PREFIX
See Also:
Constant Field Values

XHTML_NAMESPACE

public static final String XHTML_NAMESPACE
See Also:
Constant Field Values

XLINK_PREFIX

public static final String XLINK_PREFIX
See Also:
Constant Field Values

XLINK_NAMESPACE

public static final String XLINK_NAMESPACE
See Also:
Constant Field Values

WSDL_PREFIX

public static final String WSDL_PREFIX
See Also:
Constant Field Values

WSDL_NAMESPACE

public static final String WSDL_NAMESPACE
See Also:
Constant Field Values

WSDL20_PREFIX

public static final String WSDL20_PREFIX
See Also:
Constant Field Values

WSDL20_NAMESPACE

public static final String WSDL20_NAMESPACE
See Also:
Constant Field Values

HTTP_PREFIX

public static final String HTTP_PREFIX
See Also:
Constant Field Values

HTTP_NAMESPACE

public static final String HTTP_NAMESPACE
See Also:
Constant Field Values

SAWSDL_PREFIX

public static final String SAWSDL_PREFIX
See Also:
Constant Field Values

SAWSDL_NAMESPACE

public static final String SAWSDL_NAMESPACE
See Also:
Constant Field Values

LSID_PREFIX

public static final String LSID_PREFIX
See Also:
Constant Field Values

LSID_NAMESPACE

public static final String LSID_NAMESPACE
See Also:
Constant Field Values

DUBLIN_CORE_PREFIX

public static final String DUBLIN_CORE_PREFIX
See Also:
Constant Field Values

DUBLIN_CORE_NAMESPACE

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

MobyPrefixResolver

public MobyPrefixResolver()
Method Detail

getBaseIdentifier

public String getBaseIdentifier()
We don't really implement this as it can be extremely complicated.

Specified by:
getBaseIdentifier in interface org.apache.xml.utils.PrefixResolver
Returns:
null, so don't expect to resolve relative URI's in your XPaths

getAttr

public static String getAttr(Element e,
                             String attrName)
Convenience method that matches attributes in the MOBY namespace or, for now at least, with no declared namespace.

Returns:
the value of the attribute, or null if the attribute does not exist

getChildElement

public static Element getChildElement(Element e,
                                      String elementName)
Convenience method that matches attributes in the MOBY namespace or, for now at least, with no declared namespace.

Returns:
the value of the attribute, or null if the attribute does not exist

getChildElements

public static NodeList getChildElements(Element e,
                                        String elementName)
Convenience method that matches child elements in the MOBY namespace or, for now at least, with no declared namespace. "*" acts as a wildcard.

Returns:
the list of children, or null if either the element or name is null does not exist

getNamespaceForPrefix

public String getNamespaceForPrefix(String prefix)
Specified by:
getNamespaceForPrefix in interface org.apache.xml.utils.PrefixResolver
Returns:
For now, default MOBY and XML Schema Instance (1999) prefices as defined in the class static variables

getNamespaceForPrefix

public String getNamespaceForPrefix(String prefix,
                                    Node context)
Don't use this class if this method will be used. We are not returning a valid XML namespace mapping, but a convenience method for XPath, therefore we will not give context sensitive mapping.

Specified by:
getNamespaceForPrefix in interface org.apache.xml.utils.PrefixResolver

handlesNullPrefixes

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

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010