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); }
private XMLStreamReader2 createSR(ReaderConfig cfg, SystemId systemId, InputStream in, boolean forER, boolean autoCloseInput) throws XMLStreamException { return doCreateSR(cfg, systemId, StreamBootstrapper.getInstance(null, systemId, in), forER, autoCloseInput); }
public XMLValidationSchema createSchema(File f) throws XMLStreamException { ReaderConfig rcfg = createPrivateReaderConfig(); try { URL url = f.toURL(); return doCreateSchema(rcfg, StreamBootstrapper.getInstance (null, null, new FileInputStream(f)), null, url.toExternalForm(), url); } catch (IOException ioe) { throw new WstxIOException(ioe); } }
public XMLValidationSchema createSchema(InputStream in, String encoding, String publicId, String systemId) throws XMLStreamException { ReaderConfig rcfg = createPrivateReaderConfig(); return doCreateSchema(rcfg, StreamBootstrapper.getInstance (publicId, SystemId.construct(systemId), in), publicId, systemId, null); }
public XMLValidationSchema createSchema(URL url) throws XMLStreamException { ReaderConfig rcfg = createPrivateReaderConfig(); try { InputStream in = URLUtil.inputStreamFromURL(url); return doCreateSchema(rcfg, StreamBootstrapper.getInstance (null, null, in), null, url.toExternalForm(), url); } catch (IOException ioe) { throw new WstxIOException(ioe); } }
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); }
private static WstxInputSource sourceFromURL(WstxInputSource parent, ReaderConfig cfg, String refName, int xmlVersion, URL url, String pubId) throws IOException, XMLStreamException { /* And then create the input source. Note that by default URL's * own input stream creation creates buffered reader -- for us * that's useless and wasteful (adds one unnecessary level of * caching, halving the speed due to copy operations needed), so * let's avoid it. */ InputStream in = URLUtil.inputStreamFromURL(url); SystemId sysId = SystemId.construct(url); StreamBootstrapper bs = StreamBootstrapper.getInstance(pubId, sysId, in); Reader r = bs.bootstrapInput(cfg, false, xmlVersion); return InputSourceFactory.constructEntitySource (cfg, parent, refName, bs, pubId, sysId, xmlVersion, r); }
private static WstxInputSource sourceFromIS(WstxInputSource parent, ReaderConfig cfg, String refName, int xmlVersion, InputStream is, String pubId, String sysId) throws IOException, XMLStreamException { StreamBootstrapper bs = StreamBootstrapper.getInstance(pubId, SystemId.construct(sysId), is); Reader r = bs.bootstrapInput(cfg, false, xmlVersion); URL ctxt = parent.getSource(); // If we got a real sys id, we do know the source... if (sysId != null && sysId.length() > 0) { ctxt = URLUtil.urlFromSystemId(sysId, ctxt); } return InputSourceFactory.constructEntitySource (cfg, parent, refName, bs, pubId, SystemId.construct(sysId, ctxt), xmlVersion, r); }
private static WstxInputSource sourceFromSS(WstxInputSource parent, ReaderConfig cfg, String refName, int xmlVersion, StreamSource ssrc) throws IOException, XMLStreamException { InputBootstrapper bs; Reader r = ssrc.getReader(); String pubId = ssrc.getPublicId(); String sysId0 = ssrc.getSystemId(); URL ctxt = (parent == null) ? null : parent.getSource(); URL url = (sysId0 == null || sysId0.length() == 0) ? null : URLUtil.urlFromSystemId(sysId0, ctxt); final SystemId systemId = SystemId.construct(sysId0, (url == null) ? ctxt : url); if (r == null) { InputStream in = ssrc.getInputStream(); if (in == null) { // Need to try just resolving the system id then if (url == null) { throw new IllegalArgumentException("Can not create Stax reader for a StreamSource -- neither reader, input stream nor system id was set."); } in = URLUtil.inputStreamFromURL(url); } bs = StreamBootstrapper.getInstance(pubId, systemId, in); } else { bs = ReaderBootstrapper.getInstance(pubId, systemId, r, null); } Reader r2 = bs.bootstrapInput(cfg, false, xmlVersion); return InputSourceFactory.constructEntitySource (cfg, parent, refName, bs, pubId, systemId, xmlVersion, r2); }
bs = StreamBootstrapper.getInstance(publicId, systemId, is); mScanner = (BasicStreamReader) mStaxFactory.createSR(cfg, systemId, bs, false, false);
bs = StreamBootstrapper.getInstance(pubId, SystemId.construct(sysId), bas.getBuffer(), bas.getBufferStart(), bas.getBufferEnd()); } else { in = ss.constructInputStream(); bs = ReaderBootstrapper.getInstance(pubId, SystemId.construct(sysId), r, encoding); } else if (in != null) { bs = StreamBootstrapper.getInstance(pubId, SystemId.construct(sysId), in); } else if (sysId != null && sysId.length() > 0) {
private XMLStreamReader2 createSR(ReaderConfig cfg, URL src, InputStream in, boolean forER, boolean autoCloseInput) throws XMLStreamException { String systemId = src.toExternalForm(); return doCreateSR(cfg, systemId, StreamBootstrapper.getInstance(in, null, systemId), src, forER, autoCloseInput); }
private XMLStreamReader2 createSR(ReaderConfig cfg, SystemId systemId, InputStream in, boolean forER, boolean autoCloseInput) throws XMLStreamException { return doCreateSR(cfg, systemId, StreamBootstrapper.getInstance(null, systemId, in), forER, autoCloseInput); }
private XMLStreamReader2 createSR(ReaderConfig cfg, URL src, InputStream in, boolean forER, boolean autoCloseInput) throws XMLStreamException { String systemId = src.toExternalForm(); return doCreateSR(cfg, systemId, StreamBootstrapper.getInstance(in, null, systemId), src, forER, autoCloseInput); }
private XMLStreamReader2 createSR(ReaderConfig cfg, SystemId systemId, InputStream in, boolean forER, boolean autoCloseInput) throws XMLStreamException { return doCreateSR(cfg, systemId, StreamBootstrapper.getInstance(null, systemId, in), forER, autoCloseInput); }
public XMLStreamReader createXMLStreamReader(String systemId, InputStream in) throws XMLStreamException { return createSR(systemId, StreamBootstrapper.getInstance(in, null, systemId)); }
public XMLValidationSchema createSchema(InputStream in, String encoding, String publicId, String systemId) throws XMLStreamException { ReaderConfig rcfg = createPrivateReaderConfig(); return doCreateSchema(rcfg, StreamBootstrapper.getInstance (in, publicId, systemId), publicId, systemId, null); }
public XMLValidationSchema createSchema(InputStream in, String encoding, String publicId, String systemId) throws XMLStreamException { ReaderConfig rcfg = createPrivateReaderConfig(); return doCreateSchema(rcfg, StreamBootstrapper.getInstance (in, publicId, systemId), publicId, systemId, null); }
@Override public XMLValidationSchema createSchema(InputStream in, String encoding, String publicId, String systemId) throws XMLStreamException { ReaderConfig rcfg = createPrivateReaderConfig(); return doCreateSchema(rcfg, StreamBootstrapper.getInstance (publicId, SystemId.construct(systemId), in), publicId, systemId, null); }
public XMLValidationSchema createSchema(InputStream in, String encoding, String publicId, String systemId) throws XMLStreamException { ReaderConfig rcfg = createPrivateReaderConfig(); return doCreateSchema(rcfg, StreamBootstrapper.getInstance (publicId, SystemId.construct(systemId), in), publicId, systemId, null); }