[Patch] Patch for javax.xml.parsers.DocumentBuilder
Is it possible to get 2 more parse methods added to DocumentBuilder as below: /** * Parse the content of the given <code>Reader</code> as an XML * document and return a new DOM {@link Document} object. * An <code>IllegalArgumentException</code> is thrown if the * <code>Reader</code> is null. * * @param is Reader containing the content to be parsed. * * @return <code>Document</code> result of parsing the * <code>Reader</code> * * @throws IOException If any IO errors occur. * @throws SAXException If any parse errors occur. * @throws IllegalArgumentException When <code>is</code> is <code>null</code> * * @see org.xml.sax.DocumentHandler */ public Document parse(Reader reader) throws SAXException, IOException { if (reader == null) { throw new IllegalArgumentException("Reader cannot be null"); } InputSource in = new InputSource(reader); return parse(in); } /** * Parse the content of the given <code>Reader</code> as an * XML document and return a new DOM {@link Document} object. * An <code>IllegalArgumentException</code> is thrown if the * <code>Reader</code> is null. * * @param is Reader containing the content to be parsed. * @param systemId Provide a base for resolving relative URIs. * * @return A new DOM Document object. * * @throws IOException If any IO errors occur. * @throws SAXException If any parse errors occur. * @throws IllegalArgumentException When <code>is</code> is <code>null</code> * * @see org.xml.sax.DocumentHandler */ public Document parse(Reader reader, String systemId) throws SAXException, IOException { if (reader == null) { throw new IllegalArgumentException("Reader cannot be null"); } InputSource in = new InputSource(reader); in.setSystemId(systemId); return parse(in); } Basically InputSource will already accept a Reader. StringBufferInputStream is deprecated and says to use StringReader. DocumentBuilder won't parse a reader, so my problem is I can't parse an XML file that I have as a String in Memory. Thanks for your consideration, Jeffrey Haskovec
Jeffrey Haškovec wrote:
Is it possible to get 2 more parse methods added to DocumentBuilder as below:
Jeffrey - I believe the JAXP folks are at jaxp.dev.java.net and are probably not on the the core-libs mailing list. I just checked with one of the engineers in that team and he tells me it would be better to make contact via the users@jaxp.dev.java.net mailing list or the JAXP forum. -Alan.
participants (2)
-
Alan Bateman
-
Jeffrey Haškovec