Class XmlSerializer

java.lang.Object
org.htmlunit.html.XmlSerializer

public class XmlSerializer extends Object
Utility to handle conversion from HTML code to XML string.
  • Constructor Details Link icon

    • XmlSerializer Link icon

      public XmlSerializer()
  • Method Details Link icon

    • save Link icon

      public void save(SgmlPage page, File file) throws IOException
      Throws:
      IOException
    • asXml Link icon

      public String asXml(DomElement node) throws IOException
      Parameters:
      node - a node
      Returns:
      the xml representation according to the setting of this serializer
      Throws:
      IOException - in case of problem saving resources
    • printXml Link icon

      protected void printXml(DomElement node) throws IOException
      Throws:
      IOException
    • asText Link icon

      public String asText(DomNode node)
      Parameters:
      node - a node
      Returns:
      the text representation according to the setting of this serializer
    • printText Link icon

      protected void printText(DomNode node)
      Prints the text content from this node and all children.
      Parameters:
      node - the node
    • printOpeningTag Link icon

      protected void printOpeningTag(DomElement node) throws IOException
      Prints the content between "<" and ">" (or "/>") in the output of the tag name and its attributes in XML format.
      Parameters:
      node - the node whose opening tag is to be printed
      Throws:
      IOException - in case of problem saving resources
    • getAttributesFor Link icon

      protected Map<String,DomAttr> getAttributesFor(HtmlLink link) throws IOException
      Parameters:
      link - the link to get the attributes from
      Returns:
      the attribute map
      Throws:
      IOException - in case of error
    • getAttributesFor Link icon

      protected Map<String,DomAttr> getAttributesFor(HtmlImage image)
      Parameters:
      image - the image to get the attributes from
      Returns:
      the attribute map
    • isExcluded Link icon

      protected boolean isExcluded(DomElement element)
      Parameters:
      element - the element to check
      Returns:
      true if the element is a HtmlScript