Methods Summary |
---|
private static org.apache.tools.ant.BuildException | convertToBuildException(org.xml.sax.SAXException e)Translate a SAXException into a BuildException
Exception nested = e.getException();
if (nested != null) {
return new BuildException(nested);
} else {
return new BuildException(e);
}
|
public static javax.xml.parsers.DocumentBuilder | getDocumentBuilder()Returns a newly created DocumentBuilder.
try {
return getDocumentBuilderFactory().newDocumentBuilder();
} catch (ParserConfigurationException e) {
throw new BuildException(e);
}
|
private static synchronized javax.xml.parsers.DocumentBuilderFactory | getDocumentBuilderFactory()Obtains the default builder factory if not already.
if (builderFactory == null) {
try {
builderFactory = DocumentBuilderFactory.newInstance();
} catch (FactoryConfigurationError e) {
throw new BuildException("Document builder factory has not "
+ "been configured correctly: "
+ e.getMessage(), e);
}
}
return builderFactory;
|
public static synchronized javax.xml.parsers.SAXParserFactory | getNSParserFactory()Returns the parser factory to use to create namespace aware parsers.
if (nsParserFactory == null) {
nsParserFactory = newParserFactory();
nsParserFactory.setNamespaceAware(true);
}
return nsParserFactory;
|
public static org.xml.sax.XMLReader | getNamespaceXMLReader()Returns a newly created SAX 2 XMLReader, which is namespace aware
try {
return newSAXParser(getNSParserFactory()).getXMLReader();
} catch (SAXException e) {
throw convertToBuildException(e);
}
|
public static org.xml.sax.Parser | getParser()Returns a newly created SAX 1 Parser, using the default parser
factory.
try {
return newSAXParser(getParserFactory()).getParser();
} catch (SAXException e) {
throw convertToBuildException(e);
}
|
public static synchronized javax.xml.parsers.SAXParserFactory | getParserFactory()Returns the parser factory to use. Only one parser factory is
ever created by this method and is then cached for future use.
if (parserFactory == null) {
parserFactory = newParserFactory();
}
return parserFactory;
|
public 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.
return FILE_UTILS.toURI(file.getAbsolutePath());
|
public static org.xml.sax.XMLReader | getXMLReader()Returns a newly created SAX 2 XMLReader, using the default parser
factory.
try {
return newSAXParser(getParserFactory()).getXMLReader();
} catch (SAXException e) {
throw convertToBuildException(e);
}
|
public static javax.xml.parsers.SAXParserFactory | newParserFactory()Returns a new parser factory instance.
try {
return SAXParserFactory.newInstance();
} catch (FactoryConfigurationError e) {
throw new BuildException("XML parser factory has not been "
+ "configured correctly: "
+ e.getMessage(), e);
}
|
private static javax.xml.parsers.SAXParser | newSAXParser(javax.xml.parsers.SAXParserFactory factory)
try {
return factory.newSAXParser();
} catch (ParserConfigurationException e) {
throw new BuildException("Cannot create parser for the given "
+ "configuration: " + e.getMessage(), e);
} catch (SAXException e) {
throw convertToBuildException(e);
}
|