org.oddjob.arooa.xml
Class JAXPUtils

java.lang.Object
  extended by org.oddjob.arooa.xml.JAXPUtils

public class JAXPUtils
extends Object

Collection of helper methods that retrieve a ParserFactory or Parsers and Readers.

This class will create only a single factory instance.

Based on the original by Stefan Bodewig.


Constructor Summary
JAXPUtils()
           
 
Method Summary
static DocumentBuilder getDocumentBuilder()
          Returns a newly created DocumentBuilder.
static XMLReader getNamespaceXMLReader()
          Returns a newly created SAX 2 XMLReader, which is namespace aware
static SAXParserFactory getNSParserFactory()
          Returns the parser factory to use to create namespace aware parsers.
static SAXParserFactory getParserFactory()
          Returns the parser factory to use.
static XMLReader getXMLReader()
          Returns a newly created SAX 2 XMLReader, using the default parser factory.
static SAXParserFactory newParserFactory()
          Returns a new parser factory instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JAXPUtils

public JAXPUtils()
Method Detail

getParserFactory

public static SAXParserFactory getParserFactory()
                                         throws ArooaException
Returns the parser factory to use. Only one parser factory is ever created by this method and is then cached for future use.

Returns:
a SAXParserFactory to use
Throws:
ArooaException

getNSParserFactory

public static SAXParserFactory getNSParserFactory()
                                           throws ArooaException
Returns the parser factory to use to create namespace aware parsers.

Returns:
a SAXParserFactory to use which supports manufacture of namespace aware parsers
Throws:
ArooaException

newParserFactory

public static SAXParserFactory newParserFactory()
                                         throws ArooaException
Returns a new parser factory instance.

Throws:
ArooaException

getXMLReader

public static XMLReader getXMLReader()
                              throws ArooaException
Returns a newly created SAX 2 XMLReader, using the default parser factory.

See Also:
getParserFactory()
Returns:
a SAX 2 XMLReader.
Throws:
ArooaException

getNamespaceXMLReader

public static XMLReader getNamespaceXMLReader()
                                       throws ArooaException
Returns a newly created SAX 2 XMLReader, which is namespace aware

See Also:
getParserFactory()
Returns:
a SAX 2 XMLReader.
Throws:
ArooaException

getDocumentBuilder

public static DocumentBuilder getDocumentBuilder()
                                          throws ArooaException
Returns a newly created DocumentBuilder.

Returns:
a DocumentBuilder
Throws:
ArooaException