|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.extensions.xml.XMLWriter
A sample DOM writer. This sample program illustrates how to traverse a DOM tree in order to print a document that is parsed.
Field Summary | |
protected static boolean |
DEFAULT_CANONICAL
Default canonical output (false). |
protected static boolean |
DEFAULT_NAMESPACES
Default namespaces support (true). |
protected static java.lang.String |
DEFAULT_PARSER_NAME
Default parser name. |
protected static boolean |
DEFAULT_SCHEMA_FULL_CHECKING
Default Schema full checking support (false). |
protected static boolean |
DEFAULT_SCHEMA_VALIDATION
Default Schema validation support (false). |
protected static boolean |
DEFAULT_VALIDATION
Default validation support (false). |
protected static java.lang.String |
LEXICAL_HANDLER_PROPERTY_ID
Lexical handler property id (http://xml.org/sax/properties/lexical-handler). |
private boolean |
m_fCanonical
Canonical output. |
private java.io.PrintWriter |
m_fOut
Print writer. |
protected static java.lang.String |
NAMESPACES_FEATURE_ID
Namespaces feature id (http://xml.org/sax/features/namespaces). |
protected static java.lang.String |
SCHEMA_FULL_CHECKING_FEATURE_ID
Schema full checking feature id (http://apache.org/xml/features/validation/schema-full-checking). |
protected static java.lang.String |
SCHEMA_VALIDATION_FEATURE_ID
Schema validation feature id (http://apache.org/xml/features/validation/schema). |
protected static java.lang.String |
VALIDATION_FEATURE_ID
Validation feature id (http://xml.org/sax/features/validation). |
Constructor Summary | |
XMLWriter()
Default constructor. |
|
XMLWriter(boolean canonical)
Write the XML file in cannonical form. |
Method Summary | |
boolean |
getCanonical()
Get the canonical state of the writer. |
protected void |
normalizeAndPrint(char c)
Normalizes and print the given character. |
protected void |
normalizeAndPrint(java.lang.String s)
Write the string after normalization. |
private void |
processCData(org.w3c.dom.Node node)
Process CDATA nodes. |
private void |
processComment(org.w3c.dom.Node node)
Process Comment Nodes. |
private void |
processDocument(org.w3c.dom.Node node)
Process Document Nodes. |
private void |
processDocumentType(org.w3c.dom.Node node)
Process Document Type nodes. |
private void |
processElement(short type,
org.w3c.dom.Node node)
Process Element node. |
private void |
processEntityRef(org.w3c.dom.Node node)
Process EntityRef nodes. |
private void |
processInstructions(org.w3c.dom.Node node)
Process Instruction nodes. |
private void |
processOther(org.w3c.dom.Node node)
Process nodes which are not handled any other way. |
private void |
processText(org.w3c.dom.Node node)
Process Text nodes. |
void |
setCanonical(boolean canonical)
set canonical form of writting. |
void |
setOutput(java.io.OutputStream stream,
java.lang.String encoding)
Sets the output stream for printing. |
void |
setOutput(java.io.Writer writer)
Sets the output writer. |
protected org.w3c.dom.Attr[] |
sortAttributes(org.w3c.dom.NamedNodeMap attrs)
Returns a sorted list of attributes. |
void |
write(org.w3c.dom.Node node)
Writes the specified node, recursively. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String NAMESPACES_FEATURE_ID
protected static final java.lang.String VALIDATION_FEATURE_ID
protected static final java.lang.String SCHEMA_VALIDATION_FEATURE_ID
protected static final java.lang.String SCHEMA_FULL_CHECKING_FEATURE_ID
protected static final java.lang.String LEXICAL_HANDLER_PROPERTY_ID
protected static final java.lang.String DEFAULT_PARSER_NAME
protected static final boolean DEFAULT_NAMESPACES
protected static final boolean DEFAULT_VALIDATION
protected static final boolean DEFAULT_SCHEMA_VALIDATION
protected static final boolean DEFAULT_SCHEMA_FULL_CHECKING
protected static final boolean DEFAULT_CANONICAL
private java.io.PrintWriter m_fOut
private boolean m_fCanonical
Constructor Detail |
public XMLWriter()
public XMLWriter(boolean canonical)
canonical
- true if the file is to be written in cannonical formMethod Detail |
public void setCanonical(boolean canonical)
canonical
- true if canonical.public boolean getCanonical()
public void setOutput(java.io.Writer writer)
writer
- The writer to be used.public void setOutput(java.io.OutputStream stream, java.lang.String encoding) throws java.io.UnsupportedEncodingException
stream
- The output stream the XML will be written to.encoding
- The encoding to be used for the output stream.
java.io.UnsupportedEncodingException
- if the encoding passed is
not supported.public void write(org.w3c.dom.Node node)
node
- Node to be written.protected void normalizeAndPrint(java.lang.String s)
s
- String to be normalized and printed.protected void normalizeAndPrint(char c)
c
- The character to be printed.protected org.w3c.dom.Attr[] sortAttributes(org.w3c.dom.NamedNodeMap attrs)
attrs
- The array of attributes to be sorted.
private void processCData(org.w3c.dom.Node node)
node
- Node to be processed.private void processComment(org.w3c.dom.Node node)
node
- Node to be processed.private void processDocument(org.w3c.dom.Node node)
node
- Node to be processed.private void processDocumentType(org.w3c.dom.Node node)
node
- Node to be processed.private void processElement(short type, org.w3c.dom.Node node)
type
- Type of the node.node
- Node to be processed.private void processEntityRef(org.w3c.dom.Node node)
node
- Node to be processed.private void processInstructions(org.w3c.dom.Node node)
node
- Node to be processedprivate void processOther(org.w3c.dom.Node node)
node
- Node to be processed.private void processText(org.w3c.dom.Node node)
node
- Node to be processed.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |