Class NamespaceRegistry

java.lang.Object
org.dlese.dpc.xml.schema.NamespaceRegistry

public class NamespaceRegistry extends Object
NamespaceRegistry holds namespace information and provides namespace utilities.
Author:
ostwald
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static boolean
    NOT YET DOCUMENTED
    static final org.dom4j.Namespace
    NOT YET DOCUMENTED
    static final String
    schema Instance Namespace Uri
    static final String
    schema Namespace Uri
    static final String
    NOT YET DOCUMENTED
    static final String
    URI of xml namespace
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initialize the data structures used by NamespaceRegistry
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    doQname(org.dom4j.Element element)
    NOT YET DOCUMENTED
    org.dom4j.Namespace
    Gets the defaultNamespace attribute of the NamespaceRegistry object
    org.dom4j.Namespace
    Returns a namespace having a non-empty prefix and the same URI as the defaultNameSpace (if one exists).
    static org.dom4j.Namespace
    getNamespace(org.dom4j.Document doc)
    Gets the namespace attribute of the NamespaceRegistry class
    org.jaxen.SimpleNamespaceContext
    Gets the namespaceContext attribute of the NamespaceRegistry object
    static String
    Gets the namespacePrefix attribute of the NamespaceRegistry class
    Utility returns all Namespaces as a Collection.
    org.dom4j.Namespace
    Gets the namespace corresponding to the specified prefix
    org.dom4j.Namespace
    Gets the Namespace for provided URI.
    getPrefixforNS(org.dom4j.Namespace ns)
    Gets the prefix for given namespace object, but uses the LOCAL namespace (obtained by the provided namespace's uri) so that the prefix returned is correct within the local context.
    Gets the prefix corresponding to the provided uri after finding that uri's namespace.
    Gets the prefixMap attribute of the NamespaceRegistry object
    org.dom4j.QName
    getQName(String qualifiedName)
    Gets the qName attribute of the NamespaceRegistry object
    org.dom4j.Namespace
    The schemaInstanceNamespace is used to introduce "xsi:type", "xsi:nil", "xsi:schemaLocation", and "xsi:noNamespaceSchmaLocation" attributes in instance documents.
    org.dom4j.Namespace
    Gets the schemaNamespace attribute of the NamespaceRegistry object
    org.dom4j.Namespace
    Gets the targetNamespace attribute of the NamespaceRegistry object
    Gets the targetNamespaceUri attribute of the NamespaceRegistry object
    boolean
    Returns true if there is a namespace defined in addition to the default ns and the schemaNamespace.
    static boolean
    Gets the qualified attribute of the NamespaceRegistry class
    static void
    main(String[] args)
    The main program for the NamespaceRegistry class
    static String
    Make a qualified name - prefix:name;
    static String
    makeQualifiedName(org.dom4j.Namespace namespace, String name)
    Returns namespace.prefix:name, or just name if a namespace is not provided;
    Utility returns an iterator for the registed namespaces
    static String
    nsToString(org.dom4j.Namespace ns)
    NOT YET DOCUMENTED
    void
    register(org.dom4j.Namespace ns)
    Register a namespace by placing itto the uriMap (mapping uri to its namespace) and resets default namespaces so they will be recomputed using updated uriMap.
    void
    registerNamespaces(org.dom4j.Document doc)
    Register all the namespaces defined in the docuement's rootElement.
    void
    Sets the targetNamespaceUri attribute of the NamespaceRegistry object
    static String
    NOT YET DOCUMENTED
    NOT YET DOCUMENTED
    void
    unregister(org.dom4j.Namespace ns)
    Remove a namespace from prefixMap and uriMap structures.
    Debugging utility returns a printable representation of the uriMap.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • schemaInstanceNamespaceUri

      public static final String schemaInstanceNamespaceUri
      schema Instance Namespace Uri
      See Also:
    • schemaNamespaceUri

      public static final String schemaNamespaceUri
      schema Namespace Uri
      See Also:
    • xmlNamespaceUri

      public static final String xmlNamespaceUri
      URI of xml namespace
      See Also:
    • xmlNamespacePrefix

      public static final String xmlNamespacePrefix
      NOT YET DOCUMENTED
      See Also:
    • NO_NAMESPACE

      public static final org.dom4j.Namespace NO_NAMESPACE
      NOT YET DOCUMENTED
    • namedDefaultCreationEnabled

      public static boolean namedDefaultCreationEnabled
      NOT YET DOCUMENTED
  • Constructor Details

    • NamespaceRegistry

      public NamespaceRegistry()
      Initialize the data structures used by NamespaceRegistry
  • Method Details

    • register

      public void register(org.dom4j.Namespace ns)
      Register a namespace by placing itto the uriMap (mapping uri to its namespace) and resets default namespaces so they will be recomputed using updated uriMap.
      Parameters:
      ns - namespace to be registered
    • isMultiNamespace

      public boolean isMultiNamespace()
      Returns true if there is a namespace defined in addition to the default ns and the schemaNamespace. Multinamespace documents require that we ensure there is a named default namespace so all xPath references are qualified.
      Returns:
      The multiNamespace value
    • registerNamespaces

      public void registerNamespaces(org.dom4j.Document doc)
      Register all the namespaces defined in the docuement's rootElement.
      Parameters:
      doc - NOT YET DOCUMENTED
    • getNamespaceContext

      public org.jaxen.SimpleNamespaceContext getNamespaceContext()
      Gets the namespaceContext attribute of the NamespaceRegistry object
      Returns:
      The namespaceContext value
    • nsIterator

      public Iterator nsIterator()
      Utility returns an iterator for the registed namespaces
      Returns:
      NOT YET DOCUMENTED
    • getNamespaces

      public Collection getNamespaces()
      Utility returns all Namespaces as a Collection.
      Returns:
      The namespaces value
    • uriMapToString

      public String uriMapToString()
      Debugging utility returns a printable representation of the uriMap.
      Returns:
      NOT YET DOCUMENTED
    • unregister

      public void unregister(org.dom4j.Namespace ns)
      Remove a namespace from prefixMap and uriMap structures.
      Parameters:
      ns - NOT YET DOCUMENTED
    • getNamedDefaultNamespace

      public org.dom4j.Namespace getNamedDefaultNamespace()
      Returns a namespace having a non-empty prefix and the same URI as the defaultNameSpace (if one exists). Returns NO_NAMESPACE if there is no defaultNamespace in the registry.
      Returns:
      The namedDefaultNamespace value
    • getNSforUri

      public org.dom4j.Namespace getNSforUri(String uri)
      Gets the Namespace for provided URI.
      Parameters:
      uri - NOT YET DOCUMENTED
      Returns:
      A namespace object if one is found, NO_NAMESPACE otherwise
    • getPrefixforUri

      public String getPrefixforUri(String uri)
      Gets the prefix corresponding to the provided uri after finding that uri's namespace.
      Parameters:
      uri - NOT YET DOCUMENTED
      Returns:
      The prefixforUri value
    • getPrefixforNS

      public String getPrefixforNS(org.dom4j.Namespace ns)
      Gets the prefix for given namespace object, but uses the LOCAL namespace (obtained by the provided namespace's uri) so that the prefix returned is correct within the local context.

      Parameters:
      ns - NOT YET DOCUMENTED
      Returns:
      The prefixforNS value
    • getNSforPrefix

      public org.dom4j.Namespace getNSforPrefix(String prefix)
      Gets the namespace corresponding to the specified prefix
      Parameters:
      prefix - namespace prefix
      Returns:
      A namespace object, or NO_NAMESPACE if one cannot be found.
    • getPrefixMap

      public Map getPrefixMap()
      Gets the prefixMap attribute of the NamespaceRegistry object
      Returns:
      The prefixMap value
    • getTargetNamespaceUri

      public String getTargetNamespaceUri()
      Gets the targetNamespaceUri attribute of the NamespaceRegistry object
      Returns:
      The targetNamespaceUri value
    • getTargetNamespace

      public org.dom4j.Namespace getTargetNamespace()
      Gets the targetNamespace attribute of the NamespaceRegistry object
      Returns:
      The targetNamespace value
    • setTargetNamespaceUri

      public void setTargetNamespaceUri(String uri)
      Sets the targetNamespaceUri attribute of the NamespaceRegistry object
      Parameters:
      uri - The new targetNamespaceUri value
    • getDefaultNamespace

      public org.dom4j.Namespace getDefaultNamespace()
      Gets the defaultNamespace attribute of the NamespaceRegistry object
      Returns:
      The defaultNamespace value
    • getSchemaInstanceNamespace

      public org.dom4j.Namespace getSchemaInstanceNamespace()
      The schemaInstanceNamespace is used to introduce "xsi:type", "xsi:nil", "xsi:schemaLocation", and "xsi:noNamespaceSchmaLocation" attributes in instance documents. This namespece should always be defined with the xsi prefix.

      ISSUE: is it okay to assume that the schemaInstanceNamespace prefix will always be "xsi"??

      Returns:
      The schemaInstanceNamespace value
    • getSchemaNamespace

      public org.dom4j.Namespace getSchemaNamespace()
      Gets the schemaNamespace attribute of the NamespaceRegistry object
      Returns:
      The schemaNamespace value
    • doQname

      public static String doQname(org.dom4j.Element element)
      NOT YET DOCUMENTED
      Parameters:
      element - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • makeQualifiedName

      public static String makeQualifiedName(String prefix, String name)
      Make a qualified name - prefix:name;
      Parameters:
      prefix - a namespace prefix
      name - name to be qualified
      Returns:
      qualified name
    • makeQualifiedName

      public static String makeQualifiedName(org.dom4j.Namespace namespace, String name)
      Returns namespace.prefix:name, or just name if a namespace is not provided;
      Parameters:
      namespace - a namespace instance
      name - name to be qualified
      Returns:
      qualified name
    • getQName

      public org.dom4j.QName getQName(String qualifiedName) throws Exception
      Gets the qName attribute of the NamespaceRegistry object
      Parameters:
      qualifiedName - NOT YET DOCUMENTED
      Returns:
      The qName value
      Throws:
      Exception - NOT YET DOCUMENTED
    • isQualified

      public static boolean isQualified(String s)
      Gets the qualified attribute of the NamespaceRegistry class
      Parameters:
      s - NOT YET DOCUMENTED
      Returns:
      The qualified value
    • nsToString

      public static String nsToString(org.dom4j.Namespace ns)
      NOT YET DOCUMENTED
      Parameters:
      ns - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • getNamespace

      public static org.dom4j.Namespace getNamespace(org.dom4j.Document doc)
      Gets the namespace attribute of the NamespaceRegistry class
      Parameters:
      doc - NOT YET DOCUMENTED
      Returns:
      The namespace value
    • getNamespacePrefix

      public static String getNamespacePrefix(String name)
      Gets the namespacePrefix attribute of the NamespaceRegistry class
      Parameters:
      name - NOT YET DOCUMENTED
      Returns:
      The namespacePrefix value
    • stripNamespacePrefix

      public static String stripNamespacePrefix(String name)
      NOT YET DOCUMENTED
      Parameters:
      name - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • main

      public static void main(String[] args)
      The main program for the NamespaceRegistry class
      Parameters:
      args - The command line arguments
    • toString

      public String toString()
      NOT YET DOCUMENTED
      Overrides:
      toString in class Object
      Returns:
      NOT YET DOCUMENTED