Class XmlDeclaration

All Implemented Interfaces:
Cloneable

public class XmlDeclaration extends LeafNode
An XML declaration, such as <?xml version="1.0"?>, or a markup declaration, such as <!ELEMENT ...>. Use ProcessingInstruction for other <?target data?> nodes. Declaration values are available through LeafNode.attributes() and LeafNode.attr(String).
  • Constructor Details

    • XmlDeclaration

      public XmlDeclaration(String name, boolean isMarkupDeclaration)
      Creates an XML declaration or markup declaration.
      Parameters:
      name - the declaration name, such as xml or ELEMENT
      isMarkupDeclaration - true to create <!name ...>; false to create <?name ...?>
  • Method Details

    • nodeName

      public String nodeName()
      Description copied from class: Node
      Get the node name of this node. Use for debugging purposes and not logic switching (for that, use instanceof).
      Specified by:
      nodeName in class Node
      Returns:
      node name
    • name

      public String name()
      Gets the declaration name.
      Returns:
      the declaration name
    • getWholeDeclaration

      Gets the declaration data, without its name or delimiters.
      Returns:
      the declaration data
    • toString

      public String toString()
      Description copied from class: Node
      Gets this node's outer HTML.
      Overrides:
      toString in class Node
      Returns:
      outer HTML.
      See Also:
    • clone

      Description copied from class: Node
      Create a stand-alone, deep copy of this node, and all of its children. The cloned node will have no siblings.

      • If this node is a LeafNode, the clone will have no parent.
      • If this node is an Element, the clone will have a simple owning Document to retain the configured output settings and parser.

      The cloned node may be adopted into another Document or node structure using Element.appendChild(Node).

      Overrides:
      clone in class Node
      Returns:
      a stand-alone cloned node, including clones of any children
      See Also: