public URL asURL() throws IOException { if (mURL == null) { mURL = URLUtil.urlFromSystemId(mSystemId); } return mURL; }
public static URL urlFromSystemId(String sysId, URL ctxt) throws IOException { if (ctxt == null) { return urlFromSystemId(sysId); } try { return new URL(ctxt, sysId); } catch (MalformedURLException e) { throwIOException(e, sysId); return null; // never gets here } }
/** * Method called to resolve path to external DTD subset, given * system identifier. */ private URI resolveExtSubsetPath(String systemId) throws IOException { // Do we have a context to use for resolving? URL ctxt = (mInput == null) ? null : mInput.getSource(); /* Ok, either got a context or not; let's create the URL based on * the id, and optional context: */ if (ctxt == null) { /* Call will try to figure out if system id has the protocol * in it; if not, create a relative file, if it does, try to * resolve it. */ return URLUtil.uriFromSystemId(systemId); } URL url = URLUtil.urlFromSystemId(systemId, ctxt); try { return new URI(url.toExternalForm()); } catch (URISyntaxException e) { // should never occur... throw new IOException("Failed to construct URI for external subset, URL = "+url.toExternalForm()+": "+e.getMessage()); } }
public void dtdUnparsedEntityDecl(String name, String publicId, String systemId, String notationName, URL baseURL) throws XMLStreamException { if (mDTDHandler != null) { // SAX expects system id to be fully resolved? if (systemId.indexOf(':') < 0) { // relative path... try { systemId = URLUtil.urlFromSystemId(systemId, baseURL).toExternalForm(); } catch (IOException ioe) { throw new WstxIOException(ioe); } } try { mDTDHandler.unparsedEntityDecl(name, publicId, systemId, notationName); } catch (SAXException sex) { throw new WrappedSaxException(sex); } } }
public void dtdNotationDecl(String name, String publicId, String systemId, URL baseURL) throws XMLStreamException { if (mDTDHandler != null) { /* 24-Nov-2006, TSa: Note: SAX expects system identifiers to * be fully resolved when reported... */ if (systemId != null && systemId.indexOf(':') < 0) { try { systemId = URLUtil.urlFromSystemId(systemId, baseURL).toExternalForm(); } catch (IOException ioe) { throw new WstxIOException(ioe); } } try { mDTDHandler.notationDecl(name, publicId, systemId); } catch (SAXException sex) { throw new WrappedSaxException(sex); } } }
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); }
src = URLUtil.urlFromSystemId(systemId); } catch (IOException ie) { throw new WstxIOException(ie);
private static WstxInputSource sourceFromR(WstxInputSource parent, ReaderConfig cfg, String refName, int xmlVersion, Reader r, String pubId, String sysId) throws IOException, XMLStreamException { /* Last null -> no app-provided encoding (doesn't matter for non- * main-level handling) */ ReaderBootstrapper rbs = ReaderBootstrapper.getInstance(pubId, SystemId.construct(sysId), r, null); // null -> no xml reporter... should have one? Reader r2 = rbs.bootstrapInput(cfg, false, xmlVersion); URL ctxt = (parent == null) ? null : parent.getSource(); if (sysId != null && sysId.length() > 0) { ctxt = URLUtil.urlFromSystemId(sysId, ctxt); } return InputSourceFactory.constructEntitySource (cfg, parent, refName, rbs, pubId, SystemId.construct(sysId, ctxt), xmlVersion, r2); } }
+publicId+"')"); URL url = URLUtil.urlFromSystemId(systemId, pathCtxt); return sourceFromURL(parent, cfg, entityName, xmlVersion, url, publicId);
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); }
out = URLUtil.outputStreamFromURL(URLUtil.urlFromSystemId(sysId)); } catch (IOException ioe) { throw new WstxIOException(ioe);
srcUrl = URLUtil.urlFromSystemId(sysIdStr); is = URLUtil.inputStreamFromURL(srcUrl); } catch (IOException ioe) {
public URL asURL() throws IOException { if (mURL == null) { mURL = URLUtil.urlFromSystemId(mSystemId); } return mURL; }
public URL asURL() throws IOException { if (mURL == null) { mURL = URLUtil.urlFromSystemId(mSystemId); } return mURL; }
public URL asURL() throws IOException { if (mURL == null) { mURL = URLUtil.urlFromSystemId(mSystemId); } return mURL; }
public URL asURL() throws IOException { if (mURL == null) { mURL = URLUtil.urlFromSystemId(mSystemId); } return mURL; }
return createSR(cfg, URLUtil.urlFromSystemId(sysId), forER, autoCloseInput); } catch (IOException ioe) {
public static URL urlFromSystemId(String sysId, URL ctxt) throws IOException { if (ctxt == null) { return urlFromSystemId(sysId); } try { return new URL(ctxt, sysId); } catch (MalformedURLException e) { throwIOException(e, sysId); return null; // never gets here } }
public static URL urlFromSystemId(String sysId, URL ctxt) throws IOException { if (ctxt == null) { return urlFromSystemId(sysId); } try { return new URL(ctxt, sysId); } catch (MalformedURLException e) { throwIOException(e, sysId); return null; // never gets here } }
public static URL urlFromSystemId(String sysId, URL ctxt) throws IOException { if (ctxt == null) { return urlFromSystemId(sysId); } try { return new URL(ctxt, sysId); } catch (MalformedURLException e) { throwIOException(e, sysId); return null; // never gets here } }