public final class ElementNode extends Node
XmlBuilder
.Modifier and Type | Method and Description |
---|---|
ElementNode |
addChild(Node child)
Adds a child node -- of any type -- to this element.
|
protected void |
appendToElement(Element parent)
This method is called internally by
ElementNode , to append
its children to the DOM subtree rooted at the specified element. |
Document |
toDOM()
Generates a new DOM document with this element as the root.
|
protected void |
toSAX(ContentHandler handler)
Invokes the passed
ContentHandler for this element and
its children. |
void |
toStream(OutputStream out)
Writes the tree rooted at this element to an
OutputStream ,
using UTF-8 encoding, without a prologue or whitepspace between nodes. |
void |
toStream(OutputStream out,
String encoding)
Writes the tree rooted at this element to an
OutputStream ,
using a specified encoding, without a prologue or whitepspace between
nodes. |
String |
toString()
Generates an XML string, where this node is the root element.
|
String |
toString(int indentSize)
Generates an XML string, where this node is the root element.
|
getLocalName
public ElementNode addChild(Node child)
public Document toDOM()
protected void toSAX(ContentHandler handler) throws SAXException
ContentHandler
for this element and
its children. Note that the implementation class must also implement
LexicalHandler
to receive events from all nodes in the
tree (particularly comments).toSAX
in class Node
SAXException
public String toString()
public String toString(int indentSize)
This is the best choice for writing log output. If you write this string to a stream, you must use UTF-8 encoding or attach a prologue that specifies the encoding used.
public void toStream(OutputStream out)
OutputStream
,
using UTF-8 encoding, without a prologue or whitepspace between nodes.
This is the best choice for writing XML that will be read by another party.
public void toStream(OutputStream out, String encoding)
OutputStream
,
using a specified encoding, without a prologue or whitepspace between
nodes.protected void appendToElement(Element parent)
Node
ElementNode
, to append
its children to the DOM subtree rooted at the specified element.appendToElement
in class Node