org.codehaus.mojo.jaxb2.helpers
Class SimpleNamespaceResolver

java.lang.Object
  extended by org.codehaus.mojo.jaxb2.helpers.SimpleNamespaceResolver
All Implemented Interfaces:
NamespaceContext

public class SimpleNamespaceResolver
extends Object
implements NamespaceContext

Namespace resolver for XML documents. Doubles as a JAXB NamespaeContext, if we decide to use JAXB instead of DOM to parse our generated schema files.

Author:
Lennart Jörelid

Constructor Summary
SimpleNamespaceResolver(File xmlFile)
          Creates a new SimpleNamespaceResolver which collects namespace data from the provided XML file.
 
Method Summary
 String getLocalNamespaceURI()
           
 String getNamespaceURI(String prefix)
          
 Map<String,String> getNamespaceURI2PrefixMap()
           
 String getPrefix(String namespaceURI)
          
 Iterator<String> getPrefixes(String namespaceURI)
          
 String getSourceFilename()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 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.


Copyright © 2005-2012 Codehaus. All Rights Reserved.