/** * Sets the encoding of the stream. * * @param encoding The new encoding. */ public void setEncoding(String encoding) { super.setEncoding(encoding); if (fInputSource == null) { fInputSource = new InputSource(); } fInputSource.setEncoding(encoding); } // setEncoding(String)
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; } }
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; } }
/** * 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
parser.setProperty(FILTERS, filters); XMLInputSource source = new XMLInputSource(null, arg, null); source.setEncoding(iencoding); parser.parse(source);
parser.setProperty(FILTERS, filters); XMLInputSource source = new XMLInputSource(null, arg, null); source.setEncoding(iencoding); parser.parse(source);
parser.setProperty(FILTERS, filters); XMLInputSource source = new XMLInputSource(null, arg, null); source.setEncoding(iencoding); parser.parse(source);
parser.setProperty(FILTERS, filters); XMLInputSource source = new XMLInputSource(null, arg, null); source.setEncoding(iencoding); parser.parse(source);
/** 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 { 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); } }
xmlInputSource.setByteStream(byteStream); xmlInputSource.setCharacterStream(charStream); xmlInputSource.setEncoding(encoding); return xmlInputSource;
xmlInputSource.setByteStream(inputSource.getByteStream()); xmlInputSource.setCharacterStream(inputSource.getCharacterStream()); xmlInputSource.setEncoding(inputSource.getEncoding()); parse(xmlInputSource);
xmlInputSource.setByteStream(inputSource.getByteStream()); xmlInputSource.setCharacterStream(inputSource.getCharacterStream()); xmlInputSource.setEncoding(inputSource.getEncoding()); parse(xmlInputSource);
/** * Parse HTML source. * * @return a document handler containing the parsed source */ private DocumentHandler parseHtmlImpl(String source, HTMLConfiguration config, NormalizingTagBalancer tagBalancer) throws IOException { HTMLScanner htmlScanner = new HTMLScanner(); tagBalancer.setScanner(htmlScanner); DocumentHandler handler = newDocumentHandler(source); NamespaceBinder namespaceBinder = new NamespaceBinder(); namespaceBinder.setDocumentHandler(handler); namespaceBinder.setDocumentSource(tagBalancer); namespaceBinder.reset(config); tagBalancer.setDocumentHandler(namespaceBinder); // Order of filter is Scanner -> OSMLFilter -> Tag Balancer tagBalancer.setDocumentSource(htmlScanner); htmlScanner.setDocumentHandler(tagBalancer); tagBalancer.reset(config); htmlScanner.reset(config); XMLInputSource inputSource = new XMLInputSource(null, null, null); inputSource.setEncoding("UTF-8"); inputSource.setCharacterStream(new StringReader(source)); htmlScanner.setInputSource(inputSource); htmlScanner.scanDocument(true); return handler; }
/** * Parse HTML source. * * @return a document handler containing the parsed source */ private DocumentHandler parseHtmlImpl(String source, HTMLConfiguration config, NormalizingTagBalancer tagBalancer) throws IOException { HTMLScanner htmlScanner = new HTMLScanner(); tagBalancer.setScanner(htmlScanner); DocumentHandler handler = newDocumentHandler(source); NamespaceBinder namespaceBinder = new NamespaceBinder(); namespaceBinder.setDocumentHandler(handler); namespaceBinder.setDocumentSource(tagBalancer); namespaceBinder.reset(config); tagBalancer.setDocumentHandler(namespaceBinder); // Order of filter is Scanner -> OSMLFilter -> Tag Balancer tagBalancer.setDocumentSource(htmlScanner); htmlScanner.setDocumentHandler(tagBalancer); tagBalancer.reset(config); htmlScanner.reset(config); XMLInputSource inputSource = new XMLInputSource(null, null, null); inputSource.setEncoding("UTF-8"); inputSource.setCharacterStream(new StringReader(source)); htmlScanner.setInputSource(inputSource); htmlScanner.scanDocument(true); return handler; }
/** * Parse HTML source. * * @return a document handler containing the parsed source */ private DocumentHandler parseHtmlImpl(String source, HTMLConfiguration config, NormalizingTagBalancer tagBalancer) throws IOException { HTMLScanner htmlScanner = new HTMLScanner(); tagBalancer.setScanner(htmlScanner); DocumentHandler handler = newDocumentHandler(source); NamespaceBinder namespaceBinder = new NamespaceBinder(); namespaceBinder.setDocumentHandler(handler); namespaceBinder.setDocumentSource(tagBalancer); namespaceBinder.reset(config); tagBalancer.setDocumentHandler(namespaceBinder); // Order of filter is Scanner -> OSMLFilter -> Tag Balancer tagBalancer.setDocumentSource(htmlScanner); htmlScanner.setDocumentHandler(tagBalancer); tagBalancer.reset(config); htmlScanner.reset(config); XMLInputSource inputSource = new XMLInputSource(null, null, null); inputSource.setEncoding("UTF-8"); inputSource.setCharacterStream(new StringReader(source)); htmlScanner.setInputSource(inputSource); htmlScanner.scanDocument(true); return handler; }
xmlInputSource.setCharacterStream(new StringReader(data)); xmlInputSource.setEncoding(encoding); return xmlInputSource;