private XMLStreamReader parse(InputStream is, String systemIdStr, boolean restricted) throws IOException, XMLStreamException { if (!quietmode) { LOG.debug("parsing input stream " + is); } if (is == null) { return null; } SystemId systemId = SystemId.construct(systemIdStr); ReaderConfig readerConfig = XML_INPUT_FACTORY.createPrivateConfig(); if (restricted) { readerConfig.setProperty(XMLInputFactory.SUPPORT_DTD, false); } return XML_INPUT_FACTORY.createSR(readerConfig, systemId, StreamBootstrapper.getInstance(null, systemId, is), false, true); }
/** * Convenience factory method that allows for parsing a document * stored in the specified file. */ public XMLStreamReader2 createXMLStreamReader(File f) throws XMLStreamException { /* true for auto-close, since caller has no access to the underlying * input stream created from the File */ return createSR(f, false, true); }
public XMLStreamReader createXMLStreamReader(InputStream in, String enc) throws XMLStreamException { // false for auto-close, since caller has access to the input stream return createSR(null, in, enc, false, false); }
public XMLStreamReader createXMLStreamReader(Reader r) throws XMLStreamException { // false for auto-close, since caller has access to the reader return createSR(null, r, false, false); }
public XMLStreamReader createXMLStreamReader(javax.xml.transform.Source src) throws XMLStreamException { // false -> not for event. No definition for auto-close; called method will decide return createSR(src, false); }
public XMLStreamReader2 createXMLStreamReader(URL src) throws XMLStreamException { /* true for auto-close, since caller has no access to the underlying * input stream created from the URL */ return createSR(createPrivateConfig(), src, false, true); }
public XMLStreamReader createXMLStreamReader(String systemId, Reader r) throws XMLStreamException { // false for auto-close, since caller has access to the Reader return createSR(SystemId.construct(systemId), r, false, false); }
public XMLStreamReader createXMLStreamReader(String systemId, InputStream in) throws XMLStreamException { // false for auto-close, since caller has access to the input stream return createSR(SystemId.construct(systemId), in, null, false, false); }
public XMLEventReader createXMLEventReader(InputStream in, String enc) throws XMLStreamException { // false for auto-close, since caller has access to the input stream return new WstxEventReader(createEventAllocator(), createSR(null, in, enc, true, false)); }
public XMLEventReader createXMLEventReader(Reader r) throws XMLStreamException { // false for auto-close, since caller has access to the input stream return new WstxEventReader(createEventAllocator(), createSR(null, r, true, false)); }
public XMLEventReader createXMLEventReader(InputStream in) throws XMLStreamException { // false for auto-close, since caller has access to the input stream return new WstxEventReader(createEventAllocator(), createSR(null, in, null, true, false)); }
public XMLEventReader createXMLEventReader(javax.xml.transform.Source source) throws XMLStreamException { return new WstxEventReader(createEventAllocator(), createSR(source, true)); }
protected XMLStreamReader2 createSR(SystemId systemId, Reader r, boolean forER, boolean autoCloseInput) throws XMLStreamException { return createSR(createPrivateConfig(), systemId, ReaderBootstrapper.getInstance (null, systemId, r, null), forER, autoCloseInput); }
public XMLEventReader2 createXMLEventReader(File f) throws XMLStreamException { /* true for auto-close, since caller has no access to the underlying * input stream created from the File */ return new WstxEventReader(createEventAllocator(), createSR(f, true, true)); }
protected XMLStreamReader2 createSR(File f, boolean forER, boolean autoCloseInput) throws XMLStreamException { ReaderConfig cfg = createPrivateConfig(); try { /* 18-Nov-2008, TSa: If P_BASE_URL is set, and File reference is * relative, let's resolve against base... */ if (!f.isAbsolute()) { URL base = cfg.getBaseURL(); if (base != null) { URL src = new URL(base, f.getPath()); return createSR(cfg, SystemId.construct(src), URLUtil.inputStreamFromURL(src), forER, autoCloseInput); } } final SystemId systemId = SystemId.construct(f.toURL()); return createSR(cfg, systemId, new FileInputStream(f), forER, autoCloseInput); } catch (IOException ie) { throw new WstxIOException(ie); } }
protected XMLStreamReader2 createSR(SystemId systemId, InputStream in, String enc, boolean forER, boolean autoCloseInput) throws XMLStreamException { // sanity check: if (in == null) { throw new IllegalArgumentException("Null InputStream is not a valid argument"); } ReaderConfig cfg = createPrivateConfig(); if (enc == null || enc.length() == 0) { return createSR(cfg, systemId, StreamBootstrapper.getInstance (null, systemId, in), forER, autoCloseInput); } /* !!! 17-Feb-2006, TSa: We don't yet know if it's xml 1.0 or 1.1; * so have to specify 1.0 (which is less restrictive WRT input * streams). Would be better to let bootstrapper deal with it * though: */ Reader r = DefaultInputResolver.constructOptimizedReader(cfg, in, false, enc); return createSR(cfg, systemId, ReaderBootstrapper.getInstance (null, systemId, r, enc), forER, autoCloseInput); }
public XMLEventReader createXMLEventReader(String systemId, Reader r) throws XMLStreamException { // false for auto-close, since caller has access to the reader return new WstxEventReader(createEventAllocator(), createSR(SystemId.construct(systemId), r, true, false)); }
protected XMLStreamReader2 createSR(ReaderConfig cfg, URL src, boolean forER, boolean autoCloseInput) throws XMLStreamException { final SystemId systemId = SystemId.construct(src); try { return createSR(cfg, systemId, URLUtil.inputStreamFromURL(src), forER, autoCloseInput); } catch (IOException ioe) { throw new WstxIOException(ioe); } }
public XMLEventReader createXMLEventReader(String systemId, InputStream in) throws XMLStreamException { // false for auto-close, since caller has access to the input stream return new WstxEventReader(createEventAllocator(), createSR(SystemId.construct(systemId), in, null, true, false)); }