Class SimpleNamespaceResolver
- java.lang.Object
-
- org.codehaus.mojo.jaxb2.schemageneration.postprocessing.schemaenhancement.SimpleNamespaceResolver
-
- All Implemented Interfaces:
NamespaceContext
public class SimpleNamespaceResolver extends Object implements NamespaceContext
Namespace resolver for XML documents, which relates XML Namespace Prefixes to XML Namespace URIs. Doubles as a JAXB NamespaceContext, if we decide to use JAXB instead of DOM to parse our generated schema files.
- Since:
- 1.4
- Author:
- Lennart Jörelid
-
-
Constructor Summary
Constructors Constructor Description SimpleNamespaceResolver(File xmlFile)
Creates a new SimpleNamespaceResolver which collects namespace data from the provided XML file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getLocalNamespaceURI()
String
getNamespaceURI(String prefix)
Map<String,String>
getNamespaceURI2PrefixMap()
String
getPrefix(String namespaceURI)
Iterator<String>
getPrefixes(String namespaceURI)
String
getSourceFilename()
-
-
-
Constructor Detail
-
SimpleNamespaceResolver
public SimpleNamespaceResolver(File xmlFile)
Creates a new SimpleNamespaceResolver which collects namespace data from the provided XML file.- Parameters:
xmlFile
- The XML file from which to collect namespace data, should not be null.
-
-
Method Detail
-
getNamespaceURI
public String getNamespaceURI(String prefix)
- Specified by:
getNamespaceURI
in interfaceNamespaceContext
-
getPrefix
public String getPrefix(String namespaceURI)
- Specified by:
getPrefix
in interfaceNamespaceContext
-
getPrefixes
public Iterator<String> getPrefixes(String namespaceURI)
- Specified by:
getPrefixes
in interfaceNamespaceContext
-
getNamespaceURI2PrefixMap
public Map<String,String> getNamespaceURI2PrefixMap()
- Returns:
- A readonly map relating namespace URIs to namespace prefixes.
-
getLocalNamespaceURI
public String getLocalNamespaceURI()
- Returns:
- The namespace URI of the default namespace within the sourceFile of this SimpleNamespaceResolver.
-
getSourceFilename
public String getSourceFilename()
- Returns:
- The name of the source file used for this SimpleNamespaceResolver.
-
-