Package org.apache.sis.xml
Class TransformingNamespaces.Inverse
java.lang.Object
org.apache.sis.xml.TransformingNamespaces
org.apache.sis.xml.TransformingNamespaces.Inverse
- All Implemented Interfaces:
NamespaceContext
- Enclosing class:
- TransformingNamespaces
Substitutes the XML namespaces used in XML documents by namespaces used in JAXB annotations.
This is used at marshalling time for exporting legacy documents, performing the reverse of
TransformingNamespaces
. The namespace → prefix mapping is simple because various
ISO 19115-3 namespaces are mapped to the same legacy "gmd"
prefix, but the reverse
operation (prefix → namespace mapping) can often not be resolved.-
Field Summary
Fields inherited from class org.apache.sis.xml.TransformingNamespaces
context, version
-
Constructor Summary
ConstructorsConstructorDescriptionInverse
(NamespaceContext context, TransformVersion version) Creates a new namespaces transformer for the given source version. -
Method Summary
Modifier and TypeMethodDescriptiongetNamespaceURI
(String prefix) Returns the namespace used in JAXB annotations for the given prefix in XML document.Returns an arbitrary prefix for the given namespace.getPrefixes
(String namespaceURI) Returns all prefixes for the given namespace.Methods inherited from class org.apache.sis.xml.TransformingNamespaces
asJAXB, asXML
-
Constructor Details
-
Inverse
Inverse(NamespaceContext context, TransformVersion version) Creates a new namespaces transformer for the given source version.
-
-
Method Details
-
getNamespaceURI
Returns the namespace used in JAXB annotations for the given prefix in XML document. If no unique namespace can be mapped (for example if asking the namespace of legacy"gmd"
prefix), returnsXMLConstants.NULL_NS_URI
.Except for
NULL_NS_URI
, this is usually an injective function: each namespace can be created from at most one prefix.- Specified by:
getNamespaceURI
in interfaceNamespaceContext
- Overrides:
getNamespaceURI
in classTransformingNamespaces
- See Also:
-
getPrefix
Returns an arbitrary prefix for the given namespace. For example, given the"http://standards.iso.org/iso/19115/-3/mdb/1.0"
namespace from ISO 19115-3, this method returns"gmd"
which was the prefix used in legacy ISO 19139:2007.This is a surjective function: many prefixes can be created from the same namespace.
- Specified by:
getPrefix
in interfaceNamespaceContext
- Overrides:
getPrefix
in classTransformingNamespaces
-
getPrefixes
Returns all prefixes for the given namespace. There is usually only one, contrarily toTransformingNamespaces.getPrefixes(String)
which have many.This is a surjective function: many prefixes can be created from the same namespace.
- Specified by:
getPrefixes
in interfaceNamespaceContext
- Overrides:
getPrefixes
in classTransformingNamespaces
-