/** * Constructor with given node factory and given XML violation policy. * @param nodeFactory the factory * @param xmlPolicy the policy */ public HtmlBuilder(SimpleNodeFactory nodeFactory, XmlViolationPolicy xmlPolicy) { super(); this.simpleNodeFactory = nodeFactory; this.treeBuilder = new XOMTreeBuilder(nodeFactory); this.driver = null; setXmlPolicy(xmlPolicy); }
/** * Parse from SAX <code>InputSource</code>. * @param is the <code>InputSource</code> * @return the document * @throws ParsingException in case of an XML violation * @throws IOException if IO goes wrang */ public Document build(InputSource is) throws ParsingException, IOException { lazyInit(); treeBuilder.setFragmentContext(null); tokenize(is); return treeBuilder.getDocument(); }
@Override protected void appendComment(Element parent, String comment) throws SAXException { try { parent.appendChild(nodeFactory.makeComment(comment)); } catch (XMLException e) { fatal(e); } }
/** * @param reportingDoctype * @see nu.validator.htmlparser.impl.TreeBuilder#setReportingDoctype(boolean) */ public void setReportingDoctype(boolean reportingDoctype) { this.reportingDoctype = reportingDoctype; if (treeBuilder != null) { treeBuilder.setReportingDoctype(reportingDoctype); } }
/** * 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); }
/** * <code>return new FormPtrElement(name, namespace, form);</code> * @param name * @param namespace * @param form * @return */ public Element makeElement(String name, String namespace, Element form) { return new FormPtrElement(name, namespace, form); }
/** * @see nu.validator.htmlparser.impl.TreeBuilder#start() */ @Override protected void start(boolean fragment) throws SAXException { document = nodeFactory.makeDocument(); cachedTableIndex = -1; cachedTable = null; }
/** * Constructor with default node factory and given XML violation policy. * @param xmlPolicy the policy */ public HtmlBuilder(XmlViolationPolicy xmlPolicy) { this(new SimpleNodeFactory(), xmlPolicy); }
/** * Parse from SAX <code>InputSource</code>. * @param is the <code>InputSource</code> * @return the document * @throws ParsingException in case of an XML violation * @throws IOException if IO goes wrang */ public Document build(InputSource is) throws ParsingException, IOException { lazyInit(); treeBuilder.setFragmentContext(null); tokenize(is); return treeBuilder.getDocument(); }
/** * Constructor with given node factory and given XML violation policy. * @param nodeFactory the factory * @param xmlPolicy the policy */ public HtmlBuilder(SimpleNodeFactory nodeFactory, XmlViolationPolicy xmlPolicy) { super(); this.simpleNodeFactory = nodeFactory; this.treeBuilder = new XOMTreeBuilder(nodeFactory); this.driver = null; setXmlPolicy(xmlPolicy); }
/** * @param reportingDoctype * @see nu.validator.htmlparser.impl.TreeBuilder#setReportingDoctype(boolean) */ public void setReportingDoctype(boolean reportingDoctype) { this.reportingDoctype = reportingDoctype; if (treeBuilder != null) { treeBuilder.setReportingDoctype(reportingDoctype); } }
/** * 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); }
/** * <code>return new FormPtrElement(name, namespace, form);</code> * @param name * @param namespace * @param form * @return */ public Element makeElement(String name, String namespace, Element form) { return new FormPtrElement(name, namespace, form); }
/** * @see nu.validator.htmlparser.impl.TreeBuilder#start() */ @Override protected void start(boolean fragment) throws SAXException { document = nodeFactory.makeDocument(); cachedTableIndex = -1; cachedTable = null; }