public static List validate( InputSource xml, URL schemaURL, boolean skipTargetNamespaceException, EntityResolver entityResolver) { StreamSource source = null; if (xml.getCharacterStream() != null) { source = new StreamSource(xml.getCharacterStream()); } else if (xml.getByteStream() != null) { source = new StreamSource(xml.getByteStream()); } else { throw new IllegalArgumentException("Could not turn input source to stream source"); } return validate(source, schemaURL, skipTargetNamespaceException, entityResolver); }
Object[] parms1={source.getPublicId(),source.getSystemId(),null}; Object xmlsource=fConfigInputSourceCtor.newInstance(parms1); Object[] parmsa={source.getByteStream()}; fConfigSetByteStream.invoke(xmlsource,parmsa); parmsa[0]=source.getCharacterStream(); fConfigSetCharStream.invoke(xmlsource,parmsa); parmsa[0]=source.getEncoding();
public void parse(InputSource input) throws IOException, SAXException { try { InputStream s = input.getByteStream(); if (s == null) { String systemId = input.getSystemId(); if (systemId == null) { throw new SAXException(CommonResourceBundle.getInstance().getString("message.inputSource")); } parse(systemId); } else { parse(s); } } catch (FastInfosetException e) { logger.log(Level.FINE, "parsing error", e); throw new SAXException(e); } }
public void parse(InputSource source) throws SAXException, IOException systemId = source.getSystemId(); contentHandler.setDocumentLocator(this); final Reader reader = source.getCharacterStream(); try { if (reader == null) { InputStream stream = source.getByteStream(); final String encoding = source.getEncoding(); systemId = source.getSystemId(); if(systemId == null) { SAXParseException saxException = new SAXParseException(
protected boolean canResolveEntity(String publicId, String systemId) throws SAXException, IOException { final InputSource resolvedEntity = muleEntityResolver.resolveEntity(publicId, systemId); try { return resolvedEntity != null; } finally { if (resolvedEntity != null) { if (resolvedEntity.getByteStream() != null) { resolvedEntity.getByteStream().close(); } if (resolvedEntity.getCharacterStream() != null) { resolvedEntity.getCharacterStream().close(); } } } }
public void parse(InputSource input) throws IOException, SAXException { try { InputStream s = input.getByteStream(); if (s == null) { String systemId = input.getSystemId(); if (systemId == null) { throw new SAXException(CommonResourceBundle.getInstance().getString("message.inputSource")); } parse(systemId); } else { parse(s); } } catch (FastInfosetException e) { logger.log(Level.FINE, "parsing error", e); throw new SAXException(e); } }
} catch (MalformedURLException e) { if (is.getSystemId() == null && is.getCharacterStream() == null && is.getByteStream() == null) { throw new MalformedURLException( "The SAX InputSource has systemId == null && characterStream == null && byteStream == null. "
/** * Close the input source stream/reader if they had been created in this class * * @param source */ private void disposeInputSource() { if (!disposeInputSource) { return; } try { if (source.getByteStream() != null) { source.getByteStream().close(); } if (source.getCharacterStream() != null) { source.getCharacterStream().close(); } } catch (Exception e) { LOGGER.log(Level.FINE, "Trouble releasing input source streams", e); } }
public void parse(InputSource input) throws IOException, SAXException { try { InputStream s = input.getByteStream(); if (s == null) { String systemId = input.getSystemId(); if (systemId == null) { throw new SAXException(CommonResourceBundle.getInstance().getString("message.inputSource")); } parse(systemId); } else { parse(s); } } catch (FastInfosetException e) { logger.log(Level.FINE, "parsing error", e); throw new SAXException(e); } }
Reader reader = input.getCharacterStream(); if (reader != null) { try { parse(reader, input.getPublicId(), input.getSystemId()); } finally { IoUtils.closeQuietly(reader); InputStream in = input.getByteStream(); String encoding = input.getEncoding(); if (in != null) { try { parse(in, encoding, input.getPublicId(), input.getSystemId()); } finally { IoUtils.closeQuietly(in); String systemId = input.getSystemId(); if (systemId == null) { throw new SAXException("No input specified.");
if (isrc != null) { InputStream in = isrc.getByteStream(); if (in != null) { return in; Reader r = isrc.getCharacterStream(); if (r != null) { return r;
public Parser resolveEntity(String publicId, String systemId) throws SAXException, IOException { InputSource source = core.resolveEntity(publicId,systemId); if(source==null) return null; // default // ideally entity resolvers should be giving us the system ID for the resource // (or otherwise we won't be able to resolve references within this imported WSDL correctly), // but if none is given, the system ID before the entity resolution is better than nothing. if(source.getSystemId()!=null) systemId = source.getSystemId(); URL url = new URL(systemId); InputStream stream; if (useStreamFromEntityResolver) { stream = source.getByteStream(); } else { stream = url.openStream(); } return new Parser(url, new TidyXMLStreamReader(XMLStreamReaderFactory.create(url.toExternalForm(), stream, true), stream)); } }
Reader reader = inputSource.getCharacterStream(); if (reader != null) { try { InputStream in = inputSource.getByteStream(); if (in != null) { try { String systemId = inputSource.getSystemId(); if (systemId == null) {
when(inputSource1.getByteStream()).thenReturn(byteStream); closeableMocks.add(inputSource1); when(inputSource2.getCharacterStream()).thenReturn(reader); closeableMocks.add(inputSource2);
public Parser resolveEntity(String publicId, String systemId) throws SAXException, IOException { InputSource source = core.resolveEntity(publicId,systemId); if(source==null) return null; // default // ideally entity resolvers should be giving us the system ID for the resource // (or otherwise we won't be able to resolve references within this imported WSDL correctly), // but if none is given, the system ID before the entity resolution is better than nothing. if(source.getSystemId()!=null) systemId = source.getSystemId(); URL url = new URL(systemId); InputStream stream; if (useStreamFromEntityResolver) { stream = source.getByteStream(); } else { stream = url.openStream(); } return new Parser(url, new TidyXMLStreamReader(XMLStreamReaderFactory.create(url.toExternalForm(), stream, true), stream)); } }
DocumentType doctype = null; String inputEncoding = source.getEncoding(); String systemId = source.getSystemId(); DocumentImpl document = new DocumentImpl( dom, namespaceURI, qualifiedName, doctype, inputEncoding); parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, namespaceAware); if (source.getByteStream() != null) { parser.setInput(source.getByteStream(), inputEncoding); } else if (source.getCharacterStream() != null) { parser.setInput(source.getCharacterStream()); } else if (systemId != null) { URL url = new URL(systemId);
private void closeInputSourceStream(InputSource payload) throws IOException { if (payload.getByteStream() != null) { payload.getByteStream().close(); } else if (payload.getCharacterStream() != null) { payload.getCharacterStream().close(); } }
public void parse(InputSource input) throws IOException, SAXException { try { InputStream s = input.getByteStream(); if (s == null) { String systemId = input.getSystemId(); if (systemId == null) { throw new SAXException(CommonResourceBundle.getInstance().getString("message.inputSource")); } parse(systemId); } else { parse(s); } } catch (FastInfosetException e) { e.printStackTrace(); throw new SAXException(e); } }
String sysIdStr = input.getSystemId(); ReaderConfig cfg = mConfig; URL srcUrl = null; Reader r = input.getCharacterStream(); if (r == null) { is = input.getByteStream(); if (is == null) { if (sysIdStr == null) {
private void closeInputSourceStream(InputSource payload) throws IOException { if (payload.getByteStream() != null) { payload.getByteStream().close(); } else if (payload.getCharacterStream() != null) { payload.getCharacterStream().close(); } }