|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.taursys.dom.AbstractWriter com.taursys.dom.XMLWriter
This class is used to write a given Document to an OutputStream or Writer.
Field Summary | |
protected java.io.PrintWriter |
printWriter
|
Constructor Summary | |
XMLWriter()
Default constructor. |
Method Summary | |
protected void |
normalizeAndPrint(char c)
Normalizes and print the given character. |
protected void |
normalizeAndPrint(java.lang.String s)
Normalizes and prints the given string. |
protected org.w3c.dom.Attr[] |
sortAttributes(org.w3c.dom.NamedNodeMap attrs)
Returns a sorted list of attributes for the given map. |
void |
write(org.w3c.dom.Document doc,
java.io.OutputStream stream)
Writes the specified Document to the OutputStream. |
void |
write(org.w3c.dom.Document doc,
java.io.Writer writer)
Writes the specified Document to the Writer. |
protected void |
write(org.w3c.dom.Node node)
Write the specified node, recursively. |
protected void |
writeAttributes(org.w3c.dom.Node node)
Writes the attributes for the given node in alphabetic order. |
protected void |
writeElementNode(org.w3c.dom.Node node)
Write the given element node recursively. |
protected void |
writeEmptyElementNode(org.w3c.dom.Node node)
Writes the given empty element node. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.io.PrintWriter printWriter
Constructor Detail |
public XMLWriter()
Method Detail |
public void write(org.w3c.dom.Document doc, java.io.OutputStream stream)
write
in class AbstractWriter
doc
- the Document
to writestream
- the OutputStream
to write topublic void write(org.w3c.dom.Document doc, java.io.Writer writer)
write
in class AbstractWriter
doc
- the Document
to writewriter
- the Writer
to write toprotected void write(org.w3c.dom.Node node)
Nodes
:
Document
version
or encoding
properties are set, then it will produce an
initial XML processing instructions node. If the docType
property is not null, it will produce a DOCTYPE node.writeElementNode
to write the
given element node.normalizeAndPrint
to write the
contents of a text node.
node
- the starting node to write and recurse.protected void writeElementNode(org.w3c.dom.Node node)
writeEmptyElementNode
method.
Otherwise, it writes the element node itself. It begins by invoking the
writeAttributes
method to generate the attributes for the
element node. It then invokes the write
method for each child.
Finally it writes the end tag for the node.
node
- the element node to recursively write.protected void writeEmptyElementNode(org.w3c.dom.Node node)
writeAttributes
method
to generate the attributes for the node.
node
- the element node to writeprotected void writeAttributes(org.w3c.dom.Node node)
node
- the node with the attributes to write.normalizeAndPrint(java.lang.String)
protected org.w3c.dom.Attr[] sortAttributes(org.w3c.dom.NamedNodeMap attrs)
attrs
- the attribute map to sort
Attr[]
of sorted attributesprotected void normalizeAndPrint(java.lang.String s)
s
- the String
to normalize and printprotected void normalizeAndPrint(char c)
c
- the char
to normalize and print
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |