protected URL getSource() throws IOException { return mInput.getSource(); }
public String toString() { StringBuffer sb = new StringBuffer(80); sb.append("<WstxInputSource [class "); sb.append(getClass().toString()); sb.append("]; systemId: "); sb.append(getSystemId()); sb.append(", source: "); try { URL url = getSource(); sb.append(url.toString()); } catch (IOException e) { sb.append("[ERROR: "+e.getMessage()+"]"); } sb.append('>'); return sb.toString(); } }
public Object getProperty(String name) { /* 18-Nov-2008, TSa: As per [WSTX-50], should report the * actual Base URL. It can be overridden by matching * setProperty, but if not, is set to actual source * of content being parsed. */ if (WstxInputProperties.P_BASE_URL.equals(name)) { try { return mInput.getSource(); } catch (IOException e) { // not optimal but... throw new IllegalStateException(e); } } /* 23-Apr-2008, TSa: Let's NOT throw IllegalArgumentException * for unknown property; JavaDocs do not suggest it needs * to be done (different from that of XMLInputFactory * and XMLStreamWriter specification) */ return mConfig.safeGetProperty(name); }
/** * 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()); } }
/** * A very simple utility expansion method used generally when the * only way to resolve an entity is via passed resolver; and where * failing to resolve it is not fatal. */ public static WstxInputSource resolveEntityUsing (WstxInputSource refCtxt, String entityName, String publicId, String systemId, XMLResolver resolver, ReaderConfig cfg, int xmlVersion) throws IOException, XMLStreamException { URL ctxt = (refCtxt == null) ? null : refCtxt.getSource(); if (ctxt == null) { ctxt = URLUtil.urlFromCurrentDir(); } Object source = resolver.resolveEntity(publicId, systemId, ctxt.toExternalForm(), entityName); return (source == null) ? null : sourceFrom(refCtxt, cfg, entityName, xmlVersion, source); }
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 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); } }
pathCtxt = parent.getSource(); if (pathCtxt == null) { pathCtxt = URLUtil.urlFromCurrentDir();
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); }
protected URL getSource() throws IOException { return mInput.getSource(); }
protected URL getSource() { return mInput.getSource(); }
protected URL getSource() throws IOException { return mInput.getSource(); }
protected URL getSource() { return mInput.getSource(); }
baseURL = mInput.getSource(); } catch (IOException e) { throw new WstxIOException(e);
public String toString() { StringBuffer sb = new StringBuffer(80); sb.append("<WstxInputSource [class "); sb.append(getClass().toString()); sb.append("]; systemId: "); sb.append(getSystemId()); sb.append(", source: "); sb.append(getSource()); sb.append('>'); return sb.toString(); } }
public String toString() { StringBuffer sb = new StringBuffer(80); sb.append("<WstxInputSource [class "); sb.append(getClass().toString()); sb.append("]; systemId: "); sb.append(getSystemId()); sb.append(", source: "); sb.append(getSource()); sb.append('>'); return sb.toString(); } }
public String toString() { StringBuffer sb = new StringBuffer(80); sb.append("<WstxInputSource [class "); sb.append(getClass().toString()); sb.append("]; systemId: "); sb.append(getSystemId()); sb.append(", source: "); sb.append(getSource()); sb.append('>'); return sb.toString(); } }
if (mCfgTreatCharRefsAsEntities) { return new IntEntity(WstxInputLocation.getEmptyLocation(), newInput.getEntityId(), newInput.getSource(), new char[]{}, WstxInputLocation.getEmptyLocation());
final URL src; try { src = mInput.getSource(); } catch (IOException e) { throw new WstxIOException(e);
ctxt = inputSource.getSource(); } catch (IOException e) { throw new WstxIOException(e);