Module org.htmlunit

Class XmlMarkupSerializer

java.lang.Object
org.htmlunit.html.serializer.XmlMarkupSerializer

public final class XmlMarkupSerializer extends Object
The XML serialization used by innerHTML/outerHTML for XHTML and XML documents.

This is a simplified implementation of the algorithm described in DOM Parsing and Serialization - XML serialization: namespace declarations are added if the namespace of an element (or the prefix of an attribute) is not declared by the context; elements without children are written as empty elements.

Author:
Ronald Brill
  • Method Details

    • serializeChildren

      public static String serializeChildren(DomNode node, BrowserVersion browserVersion)
      Serializes the children of the given node (the innerHTML).
      Parameters:
      node - the node whose children are serialized
      browserVersion - the browser version used to determine the browser specific details
      Returns:
      the serialized children
    • serialize

      public static String serialize(DomNode node, BrowserVersion browserVersion)
      Serializes the given node including the node itself (the outerHTML).
      Parameters:
      node - the node to serialize
      browserVersion - the browser version used to determine the browser specific details
      Returns:
      the serialized node