/** * Sets the byte stream. If the byte stream is not already opened * when this object is instantiated, then the code that opens the * stream should also set the byte stream on this object. Also, if * the encoding is auto-detected, then the encoding should also be * set on this object. * * @param byteStream The new byte stream. */ public void setByteStream(InputStream byteStream) { super.setByteStream(byteStream); if (fInputSource == null) { fInputSource = new InputSource(); } fInputSource.setByteStream(byteStream); } // setByteStream(InputStream)
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { XMLInputSource src = new XMLInputSource(resourceIdentifier); String resourceName = resourceIdentifier.getLiteralSystemId(); String base; try { base = new URI(FileUtils.encodePath(resourceIdentifier.getBaseSystemId())).toURL().getFile(); } catch (URISyntaxException e) { throw new RuntimeException("Base system id incorrect, parser error", e); } if (new File(new File(base).getParent(), resourceName).exists()) src.setByteStream(new File(new File(base).getParent(), resourceName).toURL().openStream()); else src.setByteStream(new File(_docRoot, resourceName).toURL().openStream()); return src; } }
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { XMLInputSource src = new XMLInputSource(resourceIdentifier); String resourceName = resourceIdentifier.getLiteralSystemId(); String base; try { base = new URI(FileUtils.encodePath(resourceIdentifier.getBaseSystemId())).toURL().getFile(); } catch (URISyntaxException e) { throw new RuntimeException("Base system id incorrect, parser error", e); } if (new File(new File(base).getParent(), resourceName).exists()) src.setByteStream(new File(new File(base).getParent(), resourceName).toURL().openStream()); else src.setByteStream(new File(_docRoot, resourceName).toURL().openStream()); return src; } }
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { String resolvedId = resolveIdentifier(resourceIdentifier); if (resolvedId != null) { XMLInputSource xmlis = new XMLInputSource(resourceIdentifier.getPublicId(), resolvedId, resourceIdentifier.getBaseSystemId()); try { InputStream is = getXSDFromDb(resourceIdentifier.getLiteralSystemId()); xmlis.setByteStream(is); } catch (SQLException ex) { ex.printStackTrace(); } return xmlis; } return null;
private static XMLInputSource toXMLInputSource(InputSource in) { XMLInputSource xin = new XMLInputSource(in.getPublicId(), in.getSystemId(), null); xin.setByteStream(in.getByteStream()); xin.setCharacterStream(in.getCharacterStream()); xin.setEncoding(in.getEncoding()); return xin; } }
InputSource is = new InputSource(file.toURI().toASCIIString()); XMLInputSource xis = new XMLInputSource(is.getPublicId(), is.getSystemId(), null); xis.setByteStream(is.getByteStream()); PropertyManager pm = new PropertyManager(PropertyManager.CONTEXT_READER); for (Field field : PropertyManager.class.getDeclaredFields()) {
private static XMLInputSource toXMLInputSource(InputSource in) { XMLInputSource xin = new XMLInputSource(in.getPublicId(), in.getSystemId(), null); xin.setByteStream(in.getByteStream()); xin.setCharacterStream(in.getCharacterStream()); xin.setEncoding(in.getEncoding()); return xin; } }
@Override public XMLInputSource resolveEntity(XMLResourceIdentifier id) throws XNIException, IOException { String systemId = id.getLiteralSystemId(); debug("Resolving " + systemId); XMLInputSource source = new XMLInputSource(id); source.setByteStream(resolver.getStream(systemId)); return source; } }
try { if (_internalSchemas.get(new URI(resourceIdentifier.getNamespace())) != null) { src.setByteStream(new ByteArrayInputStream(_internalSchemas.get(new URI(resourceIdentifier.getNamespace())))); return src; src.setByteStream(new ByteArrayInputStream(_internalSchemas.get(location))); return src; InputStream str = _wsdlFinder.openResource(location); if (str != null) src.setByteStream(str); else { __log.debug("resolveEntity: resource not found: " + location);
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { XMLInputSource src = new XMLInputSource(resourceIdentifier); String location = ""; if (resourceIdentifier.getNamespace() != null && _schemas.get(resourceIdentifier.getNamespace()) != null) location = resourceIdentifier.getNamespace(); else if (resourceIdentifier.getLiteralSystemId() != null && _schemas.get(resourceIdentifier.getLiteralSystemId()) != null) location = resourceIdentifier.getLiteralSystemId(); else if (resourceIdentifier.getExpandedSystemId() != null && _schemas.get(resourceIdentifier.getExpandedSystemId()) != null) location = resourceIdentifier.getExpandedSystemId(); else { if (__log.isDebugEnabled()) { __log.debug("Available schemas " + _schemas.keySet()); } throw new IllegalStateException("Schema " + resourceIdentifier + " not captured"); } src.setByteStream(new ByteArrayInputStream(_schemas.get(location))); return src; } }
/** * Creates an XMLInputSource from a SAX InputSource. */ private XMLInputSource createXMLInputSource(InputSource source, String baseURI) { String publicId = source.getPublicId(); String systemId = source.getSystemId(); String baseSystemId = baseURI; InputStream byteStream = source.getByteStream(); Reader charStream = source.getCharacterStream(); String encoding = source.getEncoding(); XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, baseSystemId); xmlInputSource.setByteStream(byteStream); xmlInputSource.setCharacterStream(charStream); xmlInputSource.setEncoding(encoding); return xmlInputSource; } // createXMLInputSource(InputSource,String):XMLInputSource
/** Parses a document fragment. */ public void parse(InputSource source, DocumentFragment fragment) throws SAXException, IOException { fCurrentNode = fDocumentFragment = fragment; fDocument = fDocumentFragment.getOwnerDocument(); try { String pubid = source.getPublicId(); String sysid = source.getSystemId(); String encoding = source.getEncoding(); InputStream stream = source.getByteStream(); Reader reader = source.getCharacterStream(); XMLInputSource inputSource = new XMLInputSource(pubid, sysid, sysid); inputSource.setEncoding(encoding); inputSource.setByteStream(stream); inputSource.setCharacterStream(reader); fParserConfiguration.parse(inputSource); } catch (XMLParseException e) { Exception ex = e.getException(); if (ex != null) { throw new SAXParseException(e.getMessage(), null, ex); } throw new SAXParseException(e.getMessage(), null); } } // parse(InputSource,DocumentFragment)
/** * Parses a document fragment. */ public void parse(InputSource source, DocumentFragment fragment) throws SAXException, IOException { fCurrentNode = fDocumentFragment = fragment; fDocument = fDocumentFragment.getOwnerDocument(); try { String pubid = source.getPublicId(); String sysid = source.getSystemId(); String encoding = source.getEncoding(); InputStream stream = source.getByteStream(); Reader reader = source.getCharacterStream(); XMLInputSource inputSource = new XMLInputSource(pubid, sysid, sysid); inputSource.setEncoding(encoding); inputSource.setByteStream(stream); inputSource.setCharacterStream(reader); fParserConfiguration.parse(inputSource); } catch (XMLParseException e) { Exception ex = e.getException(); if (ex != null) { throw new SAXParseException(e.getMessage(), null, ex); } throw new SAXParseException(e.getMessage(), null); } } // parse(InputSource,DocumentFragment)
/** * Parses a document fragment. */ public void parse(InputSource source, DocumentFragment fragment) throws SAXException, IOException { fCurrentNode = fDocumentFragment = fragment; fDocument = fDocumentFragment.getOwnerDocument(); try { String pubid = source.getPublicId(); String sysid = source.getSystemId(); String encoding = source.getEncoding(); InputStream stream = source.getByteStream(); Reader reader = source.getCharacterStream(); XMLInputSource inputSource = new XMLInputSource(pubid, sysid, sysid); inputSource.setEncoding(encoding); inputSource.setByteStream(stream); inputSource.setCharacterStream(reader); fParserConfiguration.parse(inputSource); } catch (XMLParseException e) { Exception ex = e.getException(); if (ex != null) { throw new SAXParseException(e.getMessage(), null, ex); } throw new SAXParseException(e.getMessage(), null); } } // parse(InputSource,DocumentFragment)
/** Parses a document fragment. */ public void parse(InputSource source, DocumentFragment fragment) throws SAXException, IOException { fCurrentNode = fDocumentFragment = fragment; fDocument = fDocumentFragment.getOwnerDocument(); try { final String pubid = source.getPublicId(); final String sysid = source.getSystemId(); final String encoding = source.getEncoding(); final InputStream stream = source.getByteStream(); final Reader reader = source.getCharacterStream(); final XMLInputSource inputSource = new XMLInputSource(pubid, sysid, sysid); inputSource.setEncoding(encoding); inputSource.setByteStream(stream); inputSource.setCharacterStream(reader); fParserConfiguration.parse(inputSource); } catch (final XMLParseException e) { final Exception ex = e.getException(); if (ex != null) { throw new SAXParseException(e.getMessage(), null, ex); } throw new SAXParseException(e.getMessage(), null); } }
/** Parses a document fragment. */ public void parse(InputSource source, DocumentFragment fragment) throws SAXException, IOException { fCurrentNode = fDocumentFragment = fragment; fDocument = fDocumentFragment.getOwnerDocument(); try { String pubid = source.getPublicId(); String sysid = source.getSystemId(); String encoding = source.getEncoding(); InputStream stream = source.getByteStream(); Reader reader = source.getCharacterStream(); XMLInputSource inputSource = new XMLInputSource(pubid, sysid, sysid); inputSource.setEncoding(encoding); inputSource.setByteStream(stream); inputSource.setCharacterStream(reader); fParserConfiguration.parse(inputSource); } catch (XMLParseException e) { Exception ex = e.getException(); if (ex != null) { throw new SAXParseException(e.getMessage(), null, ex); } throw new SAXParseException(e.getMessage(), null); } } // parse(InputSource,DocumentFragment)
XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, baseSystemId); xmlInputSource.setByteStream(byteStream); xmlInputSource.setCharacterStream(charStream); xmlInputSource.setEncoding(encoding);
is.setByteStream(new LazyURLInputStream(physical));
is.setByteStream(entityURL.openStream()); if (is != null)
inputSource.getSystemId(), null); xmlInputSource.setByteStream(inputSource.getByteStream()); xmlInputSource.setCharacterStream(inputSource.getCharacterStream()); xmlInputSource.setEncoding(inputSource.getEncoding());