did.io
Class DOMWriter
java.lang.Object
|
+--did.io.DOMWriter
- public class DOMWriter
- extends java.lang.Object
File: DOMWriter.java
Version: 1.1
Description: This class is used to traverse a DOM tree in order to write a document to an
outputstream.
NOTE: The print() method is adding some erroneous line feeds which make the data soemwhat
unreadable in raw form without the use of an editor. This method should be fixed in
future versions.
Modification Log:
Date Name Comment
xx-xx-xxxx XXX xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Field Summary |
protected boolean |
canonical
Canonical output. |
protected java.io.FileOutputStream |
myStream
File to be written to. |
protected java.io.PrintWriter |
out
Print writer. |
Constructor Summary |
DOMWriter(boolean canonical)
Default constructor. |
DOMWriter(java.lang.String fileName)
|
DOMWriter(java.lang.String encoding,
boolean canonical)
|
Method Summary |
static java.lang.String |
getWriterEncoding()
|
static boolean |
isValidJavaEncoding(java.lang.String encoding)
|
protected java.lang.String |
normalize(java.lang.String s)
Normalizes the given string. |
void |
print(org.w3c.dom.Node node)
Prints the specified node, recursively. |
static void |
print(java.lang.String parserWrapperName,
java.lang.String uri,
boolean canonical)
Prints the resulting document tree. |
static void |
setWriterEncoding(java.lang.String encoding)
|
protected org.w3c.dom.Attr[] |
sortAttributes(org.w3c.dom.NamedNodeMap attrs)
Returns a sorted list of attributes. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
canonical
protected boolean canonical
- Canonical output.
out
protected java.io.PrintWriter out
- Print writer.
myStream
protected java.io.FileOutputStream myStream
- File to be written to.
DOMWriter
public DOMWriter(java.lang.String fileName)
throws java.io.UnsupportedEncodingException,
java.io.FileNotFoundException
DOMWriter
public DOMWriter(java.lang.String encoding,
boolean canonical)
throws java.io.UnsupportedEncodingException
DOMWriter
public DOMWriter(boolean canonical)
throws java.io.UnsupportedEncodingException
- Default constructor.
getWriterEncoding
public static java.lang.String getWriterEncoding()
setWriterEncoding
public static void setWriterEncoding(java.lang.String encoding)
isValidJavaEncoding
public static boolean isValidJavaEncoding(java.lang.String encoding)
print
public static void print(java.lang.String parserWrapperName,
java.lang.String uri,
boolean canonical)
- Prints the resulting document tree.
print
public void print(org.w3c.dom.Node node)
- Prints the specified node, recursively.
sortAttributes
protected org.w3c.dom.Attr[] sortAttributes(org.w3c.dom.NamedNodeMap attrs)
- Returns a sorted list of attributes.
normalize
protected java.lang.String normalize(java.lang.String s)
- Normalizes the given string.