Package org.dlese.dpc.xml.schema
Class NamespaceRegistry
java.lang.Object
org.dlese.dpc.xml.schema.NamespaceRegistry
NamespaceRegistry holds namespace information and provides namespace
utilities.
- Author:
- ostwald
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInitialize the data structures used by NamespaceRegistry -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdoQname(org.dom4j.Element element) NOT YET DOCUMENTEDorg.dom4j.NamespaceGets the defaultNamespace attribute of the NamespaceRegistry objectorg.dom4j.NamespaceReturns a namespace having a non-empty prefix and the same URI as the defaultNameSpace (if one exists).static org.dom4j.NamespacegetNamespace(org.dom4j.Document doc) Gets the namespace attribute of the NamespaceRegistry classorg.jaxen.SimpleNamespaceContextGets the namespaceContext attribute of the NamespaceRegistry objectstatic StringgetNamespacePrefix(String name) Gets the namespacePrefix attribute of the NamespaceRegistry classUtility returns all Namespaces as a Collection.org.dom4j.NamespacegetNSforPrefix(String prefix) Gets the namespace corresponding to the specified prefixorg.dom4j.NamespacegetNSforUri(String uri) 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.getPrefixforUri(String uri) Gets the prefix corresponding to the provided uri after finding that uri's namespace.Gets the prefixMap attribute of the NamespaceRegistry objectorg.dom4j.QNameGets the qName attribute of the NamespaceRegistry objectorg.dom4j.NamespaceThe schemaInstanceNamespace is used to introduce "xsi:type", "xsi:nil", "xsi:schemaLocation", and "xsi:noNamespaceSchmaLocation" attributes in instance documents.org.dom4j.NamespaceGets the schemaNamespace attribute of the NamespaceRegistry objectorg.dom4j.NamespaceGets the targetNamespace attribute of the NamespaceRegistry objectGets the targetNamespaceUri attribute of the NamespaceRegistry objectbooleanReturns true if there is a namespace defined in addition to the default ns and the schemaNamespace.static booleanGets the qualified attribute of the NamespaceRegistry classstatic voidThe main program for the NamespaceRegistry classstatic StringmakeQualifiedName(String prefix, String name) Make a qualified name - prefix:name;static StringmakeQualifiedName(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 namespacesstatic StringnsToString(org.dom4j.Namespace ns) NOT YET DOCUMENTEDvoidregister(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.voidregisterNamespaces(org.dom4j.Document doc) Register all the namespaces defined in the docuement's rootElement.voidSets the targetNamespaceUri attribute of the NamespaceRegistry objectstatic StringstripNamespacePrefix(String name) NOT YET DOCUMENTEDtoString()NOT YET DOCUMENTEDvoidunregister(org.dom4j.Namespace ns) Remove a namespace from prefixMap and uriMap structures.Debugging utility returns a printable representation of the uriMap.
-
Field Details
-
schemaInstanceNamespaceUri
schema Instance Namespace Uri- See Also:
-
schemaNamespaceUri
schema Namespace Uri- See Also:
-
xmlNamespaceUri
URI of xml namespace- See Also:
-
xmlNamespacePrefix
NOT YET DOCUMENTED- See Also:
-
NO_NAMESPACE
public static final org.dom4j.Namespace NO_NAMESPACENOT YET DOCUMENTED -
namedDefaultCreationEnabled
public static boolean namedDefaultCreationEnabledNOT 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
Utility returns an iterator for the registed namespaces- Returns:
- NOT YET DOCUMENTED
-
getNamespaces
Utility returns all Namespaces as a Collection.- Returns:
- The namespaces value
-
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
Gets the Namespace for provided URI.- Parameters:
uri- NOT YET DOCUMENTED- Returns:
- A namespace object if one is found, NO_NAMESPACE otherwise
-
getPrefixforUri
Gets the prefix corresponding to the provided uri after finding that uri's namespace.- Parameters:
uri- NOT YET DOCUMENTED- Returns:
- The prefixforUri value
-
getPrefixforNS
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
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
Gets the prefixMap attribute of the NamespaceRegistry object- Returns:
- The prefixMap value
-
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
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
NOT YET DOCUMENTED- Parameters:
element- NOT YET DOCUMENTED- Returns:
- NOT YET DOCUMENTED
-
makeQualifiedName
Make a qualified name - prefix:name;- Parameters:
prefix- a namespace prefixname- name to be qualified- Returns:
- qualified name
-
makeQualifiedName
Returns namespace.prefix:name, or just name if a namespace is not provided;- Parameters:
namespace- a namespace instancename- name to be qualified- Returns:
- qualified name
-
getQName
Gets the qName attribute of the NamespaceRegistry object- Parameters:
qualifiedName- NOT YET DOCUMENTED- Returns:
- The qName value
- Throws:
Exception- NOT YET DOCUMENTED
-
isQualified
Gets the qualified attribute of the NamespaceRegistry class- Parameters:
s- NOT YET DOCUMENTED- Returns:
- The qualified value
-
nsToString
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
Gets the namespacePrefix attribute of the NamespaceRegistry class- Parameters:
name- NOT YET DOCUMENTED- Returns:
- The namespacePrefix value
-
stripNamespacePrefix
NOT YET DOCUMENTED- Parameters:
name- NOT YET DOCUMENTED- Returns:
- NOT YET DOCUMENTED
-
main
The main program for the NamespaceRegistry class- Parameters:
args- The command line arguments
-
toString
NOT YET DOCUMENTED
-