Package org.htmlunit.html

# 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 Summary

  Constructors
  Constructor
  Description
  `XmlSerializer()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `asText(DomNode node)`
  `String`
  `asXml(DomElement node)`
  `protected Map<String,DomAttr>`
  `getAttributesFor(HtmlImage image)`
  `protected Map<String,DomAttr>`
  `getAttributesFor(HtmlLink link)`
  `protected boolean`
  `isExcluded(DomElement element)`
  `protected void`
  `printOpeningTag(DomElement node)`
  Prints the content between "<" and ">" (or "/>") in the output of the tag name and its attributes in XML format.
  `protected void`
  `printText(DomNode node)`
  Prints the text content from this node and all children.
  `protected void`
  `printXml(DomElement node)`
  `void`
  `save(SgmlPage page, File file)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### XmlSerializer

    public XmlSerializer()

- ## Method Details

  - ### save

    public void save(SgmlPage page, File file) throws IOException
    Throws:
      `IOException`

  - ### asXml

    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

    protected void printXml(DomElement node) throws IOException
    Throws:
      `IOException`

  - ### asText

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

  - ### printText

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

  - ### printOpeningTag

    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

    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

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

  - ### isExcluded

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