Module org.htmlunit

Class HtmlUnitNekoHtmlParser

java.lang.Object
org.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser
All Implemented Interfaces:
HTMLParser

public final class HtmlUnitNekoHtmlParser extends Object implements HTMLParser

SAX parser implementation that uses the NekoHTML HTMLConfiguration to parse HTML into a HtmlUnit-specific DOM (HU-DOM) tree.

Author:
Christian Sell, David K. Taylor, Chris Erskine, Ahmed Ashour, Marc Guillemot, Ethan Glasser-Camp, Sudhan Moghe, Ronald Brill, Frank Danek, Carsten Steul
  • Field Details

  • Constructor Details

    • HtmlUnitNekoHtmlParser

      public HtmlUnitNekoHtmlParser()
  • Method Details

    • parseFragment

      public void parseFragment(WebClient webClient, DomNode parent, DomNode context, String source, boolean createdByJavascript) throws SAXException, IOException
      Parses the HTML content from the given string into an object tree representation.
      Specified by:
      parseFragment in interface HTMLParser
      Parameters:
      webClient - the WebClient
      parent - where the new parsed nodes will be added to
      context - the context to build the fragment context stack
      source - the (X)HTML to be parsed
      createdByJavascript - if true the (script) tag was created by javascript
      Throws:
      SAXException - if a SAX error occurs
      IOException - if an IO error occurs
    • parse

      public void parse(WebClient webClient, WebResponse webResponse, HtmlPage page, boolean xhtml, boolean createdByJavascript) throws IOException
      Parses the WebResponse into an object tree representation.
      Specified by:
      parse in interface HTMLParser
      Parameters:
      webClient - the WebClient
      webResponse - the response data
      page - the HtmlPage to add the nodes
      xhtml - if true use the XHtml parser
      createdByJavascript - if true the (script) tag was created by javascript
      Throws:
      IOException - if there is an IO error
    • getSvgFactory

      public ElementFactory getSvgFactory()
      INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
      Specified by:
      getSvgFactory in interface HTMLParser
      Returns:
      a factory for creating SvgElements representing the given tag
    • getFactory

      public ElementFactory getFactory(String tagName)
      INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
      Specified by:
      getFactory in interface HTMLParser
      Parameters:
      tagName - an HTML element tag name
      Returns:
      a factory for creating HtmlElements representing the given tag
    • getElementFactory

      public ElementFactory getElementFactory(SgmlPage page, String namespaceURI, String qualifiedName, boolean insideSvg, boolean svgSupport)
      INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
      Returns the pre-registered element factory corresponding to the specified tag, or an UnknownElementFactory.
      Specified by:
      getElementFactory in interface HTMLParser
      Parameters:
      page - the page
      namespaceURI - the namespace URI
      qualifiedName - the qualified name
      insideSvg - is the node inside an SVG node or not
      svgSupport - true if called from javascript createElementNS
      Returns:
      the pre-registered element factory corresponding to the specified tag, or an UnknownElementFactory