Package org.apache.tools.ant.util
Class JAXPUtils
- java.lang.Object
- 
- org.apache.tools.ant.util.JAXPUtils
 
- 
 public class JAXPUtils extends java.lang.ObjectCollection of helper methods that retrieve a ParserFactory or Parsers and Readers.This class will create only a single factory instance. - Since:
- Ant 1.5
 
- 
- 
Constructor SummaryConstructors Constructor Description JAXPUtils()
 - 
Method SummaryModifier and Type Method Description static javax.xml.parsers.DocumentBuildergetDocumentBuilder()Returns a newly created DocumentBuilder.static org.xml.sax.XMLReadergetNamespaceXMLReader()Returns a newly created SAX 2 XMLReader, which is namespace awarestatic javax.xml.parsers.SAXParserFactorygetNSParserFactory()Returns the parser factory to use to create namespace aware parsers.static org.xml.sax.ParsergetParser()Returns a newly created SAX 1 Parser, using the default parser factory.static javax.xml.parsers.SAXParserFactorygetParserFactory()Returns the parser factory to use.static java.lang.StringgetSystemId(java.io.File file)This is a best attempt to provide a URL.toExternalForm() from a file URL.static org.xml.sax.XMLReadergetXMLReader()Returns a newly created SAX 2 XMLReader, using the default parser factory.static javax.xml.parsers.SAXParserFactorynewParserFactory()Returns a new parser factory instance.
 
- 
- 
- 
Method Detail- 
getParserFactorypublic static javax.xml.parsers.SAXParserFactory getParserFactory() throws BuildExceptionReturns 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:
- BuildException- on error.
- Since:
- Ant 1.5
 
 - 
getNSParserFactorypublic static javax.xml.parsers.SAXParserFactory getNSParserFactory() throws BuildExceptionReturns the parser factory to use to create namespace aware parsers.- Returns:
- a SAXParserFactory to use which supports manufacture of namespace aware parsers.
- Throws:
- BuildException- on error.
- Since:
- Ant 1.6
 
 - 
newParserFactorypublic static javax.xml.parsers.SAXParserFactory newParserFactory() throws BuildExceptionReturns a new parser factory instance.- Returns:
- the parser factory.
- Throws:
- BuildException- on error.
- Since:
- Ant 1.5
 
 - 
getParserpublic static org.xml.sax.Parser getParser() throws BuildExceptionReturns a newly created SAX 1 Parser, using the default parser factory.- Returns:
- a SAX 1 Parser.
- Throws:
- BuildException- on error.
- Since:
- Ant 1.5
- See Also:
- getParserFactory()
 
 - 
getXMLReaderpublic static org.xml.sax.XMLReader getXMLReader() throws BuildExceptionReturns a newly created SAX 2 XMLReader, using the default parser factory.- Returns:
- a SAX 2 XMLReader.
- Throws:
- BuildException- on error.
- Since:
- Ant 1.5
- See Also:
- getParserFactory()
 
 - 
getNamespaceXMLReaderpublic static org.xml.sax.XMLReader getNamespaceXMLReader() throws BuildExceptionReturns a newly created SAX 2 XMLReader, which is namespace aware- Returns:
- a SAX 2 XMLReader.
- Throws:
- BuildException- on error.
- Since:
- Ant 1.6
- See Also:
- getParserFactory()
 
 - 
getSystemIdpublic static java.lang.String getSystemId(java.io.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.- Parameters:
- file- the file to create the system id from.
- Returns:
- the systemid corresponding to the given file.
- Since:
- Ant 1.5.2
 
 - 
getDocumentBuilderpublic static javax.xml.parsers.DocumentBuilder getDocumentBuilder() throws BuildExceptionReturns a newly created DocumentBuilder.- Returns:
- a DocumentBuilder.
- Throws:
- BuildException- on error.
- Since:
- Ant 1.6
 
 
- 
 
-