Class DOMParser

java.lang.Object
org.teavm.jso.dom.xml.DOMParser
All Implemented Interfaces:
JSObject

public abstract class DOMParser extends Object implements JSObject
The DOMParser interface provides the ability to parse XML or HTML source code from a string into a DOM Document.
  • Constructor Details

    • DOMParser

      public DOMParser()
  • Method Details

    • create

      public static DOMParser create()
    • parseFromString

      public abstract Document parseFromString(String s, String mimeType)
      Parses the given string.

      Note that if the parsing process fails, the DOMParser does not throw an exception, but instead returns an error document:

         
           (error description) 
           (a snippet of the source XML)
         
       
      The parsing errors are also reported to the Error Console, with the document URI (see below) as the source of the error.
      Parameters:
      s - The string to be parsed. It must contain either HTML, xml, xhtml+xml, or svg document.
      mimeType - This string determines a class of the the method's return value. The possible values are the following: text/html, text/xml, application/xml, application/xhtml+xml, image/svg+xml
      Returns:
      Newly created Document or HTMLDocument