Class NamespaceHandling
java.lang.Object
org.exolab.castor.xml.parsing.NamespaceHandling
This class is used by the
UnmarshalHandler to handle name spaces. It
manages a stack of name spaces, keeps track of when an new name space scope
is needed and maps name space URIs to package names.- Since:
- 1.3.2
- Author:
- Philipp Erlacher
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDefaultNamespace(String namespaceURI) Binds the namespaceURI to the default namespace.voidaddNamespace(String prefix, String namespaceURI) Binds the namespaceURI to the prefixvoidaddNamespaceToPackageMapping(String nsURI, String packageName) Adds a mapping from the given namespace URI to the given package name.voidCreates a new name space.Gets the namespace URI that is bound to the default name space.getMappedPackage(String namespace) Looks up the package name from the given namespace URI.getNamespacePrefix(String namespaceURI) Gets the prefix that is bound to a namespaceURI.Returns the namespace stack.getNamespaceURI(String prefix) Gets the namespaceURI that is bound to a prefix.booleanIndicates whether a new name space scope is needed.voidprocessNamespaces(XMLClassDescriptor classDesc, Object object) Saves local namespace declarations to the object model if necessary.voidPops the current namespace instanceresolveNamespace(Object value) Extracts the prefix and resolves it to it's associated namespace.voidsetNewNamespaceScopeNecessary(boolean value) voidStarts a new name space scope, and resets the corresponding flag.voidStops a name space scope, and resets the corresponding flag to false.
-
Constructor Details
-
NamespaceHandling
public NamespaceHandling()
-
-
Method Details
-
addNamespaceToPackageMapping
-
getMappedPackage
-
processNamespaces
Saves local namespace declarations to the object model if necessary.- Parameters:
classDesc- the current ClassDescriptor.object- the Object of the current state
-
resolveNamespace
Extracts the prefix and resolves it to it's associated namespace. If the prefix is 'xml', then no resolution will occur, however in all other cases the resolution will change the prefix:value as {NamespaceURI}value- Parameters:
value- the QName to resolve.- Returns:
- Throws:
SAXException- if the nammespace associated with the prefix is null
-
removeCurrentNamespaceInstance
public void removeCurrentNamespaceInstance()Pops the current namespace instance -
addDefaultNamespace
Binds the namespaceURI to the default namespace.- Parameters:
namespaceURI- Namespace URI
-
addNamespace
-
getNamespacePrefix
-
getNamespaceURI
-
getDefaultNamespaceURI
Gets the namespace URI that is bound to the default name space.- Returns:
- namespaceURI The namespace URI bound to the default namespace.
-
createNamespace
public void createNamespace()Creates a new name space. -
getNamespaceStack
Returns the namespace stack.- Returns:
- the namespace stack.
-
isNewNamespaceScopeNecessary
public boolean isNewNamespaceScopeNecessary()Indicates whether a new name space scope is needed.- Returns:
- true if a new name space scope is necessary.
-
startNamespaceScope
public void startNamespaceScope()Starts a new name space scope, and resets the corresponding flag. -
stopNamespaceScope
public void stopNamespaceScope()Stops a name space scope, and resets the corresponding flag to false. -
setNewNamespaceScopeNecessary
public void setNewNamespaceScopeNecessary(boolean value)
-