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
  • Field Details

  • Constructor Details

    • 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 Details

    • getNamespaceURI

      public String getNamespaceURI(String prefix)
      Specified by:
      getNamespaceURI in interface NamespaceContext
    • getPrefix

      public String getPrefix(String namespaceURI)
      Specified by:
      getPrefix in interface NamespaceContext
    • getPrefixes

      public Iterator<String> getPrefixes(String namespaceURI)
      Specified by:
      getPrefixes in interface NamespaceContext
    • 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.
    • initialize

      private void initialize(Reader xmlFileStream)
      Initializes this SimpleNamespaceResolver to collect namespace data from the provided stream.
      Parameters:
      xmlFileStream - A Reader connected to the XML file from which we should read namespace data.