org.apache.tools.ant.util
Class JAXPUtils
java.lang.Object
org.apache.tools.ant.util.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.
static DocumentBuilder | getDocumentBuilder() - Returns a newly created DocumentBuilder.
|
static SAXParserFactory | getNSParserFactory() - Returns the parser factory to use to create namespace aware parsers.
|
static XMLReader | getNamespaceXMLReader() - Returns a newly created SAX 2 XMLReader, which is namespace aware
|
static Parser | getParser() - Returns a newly created SAX 1 Parser, using the default parser
factory.
|
static SAXParserFactory | getParserFactory() - Returns the parser factory to use.
|
static String | getSystemId(File file) - This is a best attempt to provide a URL.toExternalForm() from
a file URL.
|
static XMLReader | getXMLReader() - Returns a newly created SAX 2 XMLReader, using the default parser
factory.
|
static SAXParserFactory | newParserFactory() - Returns a new parser factory instance.
|
getDocumentBuilder
public static DocumentBuilder getDocumentBuilder()
throws BuildException
Returns a newly created DocumentBuilder.
getNSParserFactory
public static SAXParserFactory getNSParserFactory()
throws BuildException
Returns the parser factory to use to create namespace aware parsers.
- a SAXParserFactory to use which supports manufacture of
namespace aware parsers
getNamespaceXMLReader
public static XMLReader getNamespaceXMLReader()
throws BuildException
Returns a newly created SAX 2 XMLReader, which is namespace aware
getParser
public static Parser getParser()
throws BuildException
Returns a newly created SAX 1 Parser, using the default parser
factory.
getParserFactory
public static SAXParserFactory getParserFactory()
throws BuildException
Returns the parser factory to use. Only one parser factory is
ever created by this method and is then cached for future use.
- a SAXParserFactory to use
getSystemId
public static String getSystemId(File file)
This is a best attempt to provide a URL.toExternalForm() from
a file URL. Some parsers like Crimson choke on uri that are made of
backslashed paths (ie windows) as it is does not conform
URI specifications.
file
- the file to create the system id from.
- the systemid corresponding to the given file.
getXMLReader
public static XMLReader getXMLReader()
throws BuildException
Returns a newly created SAX 2 XMLReader, using the default parser
factory.
newParserFactory
public static SAXParserFactory newParserFactory()
throws BuildException
Returns a new parser factory instance.
Copyright B) 2000-2007 Apache Software Foundation. All Rights Reserved.