/** * @param file the filename to use for the systemid * @return the systemid * @deprecated since 1.5.x. * Use org.apache.tools.ant.util.JAXPUtils#getSystemId instead. */ @Deprecated protected String getSystemId(final File file) { return JAXPUtils.getSystemId(file); }
/** * Returns the parser factory to use. Only one parser factory is * ever created by this method and is then cached for future use. * * @return a SAXParserFactory to use. * @throws BuildException on error. * * @since Ant 1.5 */ public static synchronized SAXParserFactory getParserFactory() throws BuildException { if (parserFactory == null) { parserFactory = newParserFactory(); } return parserFactory; }
/** * Returns a newly created SAX 2 XMLReader, using the default parser * factory. * * @return a SAX 2 XMLReader. * @throws BuildException on error. * @see #getParserFactory * @since Ant 1.5 */ public static XMLReader getXMLReader() throws BuildException { try { return newSAXParser(getParserFactory()).getXMLReader(); } catch (SAXException e) { throw convertToBuildException(e); } }
/** * Get our reader * @return a reader */ private XMLReader getReader() { JAXPUtils.getParser(); return JAXPUtils.getXMLReader(); }
/** * Returns a newly created SAX 2 XMLReader, which is namespace aware * * @return a SAX 2 XMLReader. * @throws BuildException on error. * @see #getParserFactory * @since Ant 1.6 */ public static XMLReader getNamespaceXMLReader() throws BuildException { try { return newSAXParser(getNSParserFactory()).getXMLReader(); } catch (SAXException e) { throw convertToBuildException(e); } }
private static String getNamespaceParserName() { try { XMLReader reader = JAXPUtils.getNamespaceXMLReader(); return reader.getClass().getName(); } catch (BuildException e) { //ignore ignoreThrowable(e); return null; } }
/** * Get a new Document instance, * @return the document. * @since Ant 1.6.3 */ public static Document newDocument() { return JAXPUtils.getDocumentBuilder().newDocument(); }
/** * Returns a newly created DocumentBuilder. * * @return a DocumentBuilder. * @throws BuildException on error. * @since Ant 1.6 */ public static DocumentBuilder getDocumentBuilder() throws BuildException { try { return getDocumentBuilderFactory().newDocumentBuilder(); } catch (ParserConfigurationException e) { throw new BuildException(e); } }
/** * @return a new SAXParser instance as helper for getParser and * getXMLReader. * * @since Ant 1.5 */ private static SAXParser newSAXParser(SAXParserFactory factory) throws BuildException { 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); } }
/** * Returns a SAX-based XMLReader or a SAX-based Parser. * @return reader or parser */ private Object createDefaultReaderOrParser() { Object reader; try { reader = createDefaultReader(); } catch (BuildException exc) { reader = JAXPUtils.getParser(); } return reader; }
parser = JAXPUtils.getParser(); } catch (BuildException e) { parser = new XMLReaderAdapter(JAXPUtils.getXMLReader());
private static String getNamespaceParserLocation() { try { XMLReader reader = JAXPUtils.getNamespaceXMLReader(); URL location = getClassLocation(reader.getClass()); return location != null ? location.toString() : null; } catch (BuildException e) { //ignore ignoreThrowable(e); return null; } }
/** * Constructor for XMLFragment object. */ public XMLFragment() { doc = JAXPUtils.getDocumentBuilder().newDocument(); fragment = doc.createDocumentFragment(); }
src.setSystemId(JAXPUtils.getSystemId(infile)); return src;
/** * Returns a newly created SAX 1 Parser, using the default parser * factory. * * @return a SAX 1 Parser. * @throws BuildException on error. * @see #getParserFactory * @since Ant 1.5 */ public static Parser getParser() throws BuildException { try { return newSAXParser(getParserFactory()).getParser(); } catch (SAXException e) { throw convertToBuildException(e); } }
/** * Returns the parser factory to use to create namespace aware parsers. * * @return a SAXParserFactory to use which supports manufacture of * namespace aware parsers. * @throws BuildException on error. * * @since Ant 1.6 */ public static synchronized SAXParserFactory getNSParserFactory() throws BuildException { if (nsParserFactory == null) { nsParserFactory = newParserFactory(); nsParserFactory.setNamespaceAware(true); } return nsParserFactory; }
XMLReader parser = JAXPUtils.getNamespaceXMLReader();
final StreamResult res = new StreamResult(fos); res.setSystemId(JAXPUtils.getSystemId(outfile)); final Source src = getSource(fis, infile);
/** * Returns the parser factory to use to create namespace aware parsers. * * @return a SAXParserFactory to use which supports manufacture of namespace aware parsers * * @since Ant 1.6 from org.apache.tools.ant.util.JAXPUtils */ private SAXParserFactory getNSParserFactory() throws BuildException { SAXParserFactory nsParserFactory = JAXPUtils.newParserFactory(); nsParserFactory.setNamespaceAware(true); return nsParserFactory; }
try { source = new InputSource(Files.newInputStream(resFile.toPath())); String sysid = JAXPUtils.getSystemId(resFile); source.setSystemId(sysid); log("catalog entry matched a readable file: '"