org.oddjob.arooa.xml
Class JAXPUtils

java.lang.Object
  extended byorg.oddjob.arooa.xml.JAXPUtils

public class JAXPUtils
extends java.lang.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 javax.xml.parsers.DocumentBuilder getDocumentBuilder()
          Returns a newly created DocumentBuilder.
static org.xml.sax.XMLReader getNamespaceXMLReader()
          Returns a newly created SAX 2 XMLReader, which is namespace aware
static javax.xml.parsers.SAXParserFactory getNSParserFactory()
          Returns the parser factory to use to create namespace aware parsers.
static javax.xml.parsers.SAXParserFactory getParserFactory()
          Returns the parser factory to use.
static org.xml.sax.XMLReader getXMLReader()
          Returns a newly created SAX 2 XMLReader, using the default parser factory.
static javax.xml.parsers.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 javax.xml.parsers.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 javax.xml.parsers.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 javax.xml.parsers.SAXParserFactory newParserFactory()
                                                           throws ArooaException
Returns a new parser factory instance.

Throws:
ArooaException

getXMLReader

public static org.xml.sax.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 org.xml.sax.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 javax.xml.parsers.DocumentBuilder getDocumentBuilder()
                                                            throws ArooaException
Returns a newly created DocumentBuilder.

Returns:
a DocumentBuilder
Throws:
ArooaException