/** * Parses a document from a SAX <code>InputSource</code>. * @param is the source * @return the doc * @throws SAXException if stuff goes wrong * @throws IOException if IO goes wrong * @see javax.xml.parsers.DocumentBuilder#parse(org.xml.sax.InputSource) */ @Override public Document parse(InputSource is) throws SAXException, IOException { treeBuilder.setFragmentContext(null); tokenize(is); return treeBuilder.getDocument(); }
/** * Instantiates the document builder with the JAXP DOM implementation * and a specific XML violation policy. * @param xmlPolicy the policy */ public HtmlDocumentBuilder(XmlViolationPolicy xmlPolicy) { this(jaxpDOMImplementation(), xmlPolicy); }
/** * Instantiates the document builder with a specific DOM * implementation and XML violation policy. * * @param implementation * the DOM implementation * @param xmlPolicy the policy */ public HtmlDocumentBuilder(DOMImplementation implementation, XmlViolationPolicy xmlPolicy) { this.implementation = implementation; this.treeBuilder = new DOMTreeBuilder(implementation); this.driver = null; setXmlPolicy(xmlPolicy); }
/** * Sets whether comment nodes appear in the tree. * @param ignoreComments <code>true</code> to ignore comments * @see nu.validator.htmlparser.impl.TreeBuilder#setIgnoringComments(boolean) */ public void setIgnoringComments(boolean ignoreComments) { treeBuilder.setIgnoringComments(ignoreComments); }
/** * Sets whether the parser considers scripting to be enabled for noscript treatment. * @param scriptingEnabled <code>true</code> to enable * @see nu.validator.htmlparser.impl.TreeBuilder#setScriptingEnabled(boolean) */ public void setScriptingEnabled(boolean scriptingEnabled) { this.scriptingEnabled = scriptingEnabled; if (treeBuilder != null) { treeBuilder.setScriptingEnabled(scriptingEnabled); } }
/** * @param reportingDoctype * @see nu.validator.htmlparser.impl.TreeBuilder#setReportingDoctype(boolean) */ public void setReportingDoctype(boolean reportingDoctype) { this.reportingDoctype = reportingDoctype; if (treeBuilder != null) { treeBuilder.setReportingDoctype(reportingDoctype); } }
/** Creates an <code>HTMLDocument</code> object with the minimal tree made * of the following elements: * <code>html</code> , * <code>head</code> , * <code>title</code> , and * <code>body</code> . * * @return A new <code>HTMLDocument</code> object. */ public HTMLDocument newDocument(){ return (HTMLDocument)htb.newDocument(); }
/** * Parses a document from a SAX <code>InputSource</code>. * @param is the source * @return the doc * @throws SAXException if stuff goes wrong * @throws IOException if IO goes wrong * @see javax.xml.parsers.DocumentBuilder#parse(org.xml.sax.InputSource) */ @Override public Document parse(InputSource is) throws SAXException, IOException { treeBuilder.setFragmentContext(null); tokenize(is); return treeBuilder.getDocument(); }
/** * Instantiates the document builder with the JAXP DOM implementation * and a specific XML violation policy. * @param xmlPolicy the policy */ public HtmlDocumentBuilder(XmlViolationPolicy xmlPolicy) { this(jaxpDOMImplementation(), xmlPolicy); }
/** * Sets whether comment nodes appear in the tree. * @param ignoreComments <code>true</code> to ignore comments * @see nu.validator.htmlparser.impl.TreeBuilder#setIgnoringComments(boolean) */ public void setIgnoringComments(boolean ignoreComments) { treeBuilder.setIgnoringComments(ignoreComments); }
/** * Sets whether the parser considers scripting to be enabled for noscript treatment. * @param scriptingEnabled <code>true</code> to enable * @see nu.validator.htmlparser.impl.TreeBuilder#setScriptingEnabled(boolean) */ public void setScriptingEnabled(boolean scriptingEnabled) { this.scriptingEnabled = scriptingEnabled; if (treeBuilder != null) { treeBuilder.setScriptingEnabled(scriptingEnabled); } }
/** * Instantiates the document builder with the JAXP DOM implementation * and a specific XML violation policy. * @param xmlPolicy the policy */ public HtmlDocumentBuilder(XmlViolationPolicy xmlPolicy) { this(jaxpDOMImplementation(), xmlPolicy); }
/** * Sets whether comment nodes appear in the tree. * @param ignoreComments <code>true</code> to ignore comments * @see nu.validator.htmlparser.impl.TreeBuilder#setIgnoringComments(boolean) */ public void setIgnoringComments(boolean ignoreComments) { treeBuilder.setIgnoringComments(ignoreComments); }
/** * Sets whether the parser considers scripting to be enabled for noscript treatment. * @param scriptingEnabled <code>true</code> to enable * @see nu.validator.htmlparser.impl.TreeBuilder#setScriptingEnabled(boolean) */ public void setScriptingEnabled(boolean scriptingEnabled) { this.scriptingEnabled = scriptingEnabled; if (treeBuilder != null) { treeBuilder.setScriptingEnabled(scriptingEnabled); } }