edu.sc.seis.fissuresUtil.xml
Class Writer

java.lang.Object
  extended by edu.sc.seis.fissuresUtil.xml.Writer

public class Writer
extends java.lang.Object

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  boolean fCanonical
          Canonical output.
protected  java.io.PrintWriter fOut
          Print writer.
protected static java.lang.String LEXICAL_HANDLER_PROPERTY_ID
          Lexical handler property id (http://xml.org/sax/properties/lexical-handler).
protected static java.lang.String NAMESPACES_FEATURE_ID
          Namespaces feature id (http://xml.org/sax/features/namespaces).
protected  boolean printNewlines
          Print newlines after end elements
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
Writer()
          Default constructor.
Writer(boolean canonical)
           
Writer(boolean canonical, boolean printNewlines)
           
 
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.
 void setCanonical(boolean canonical)
          Sets whether output is canonical.
 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

NAMESPACES_FEATURE_ID

protected static final java.lang.String NAMESPACES_FEATURE_ID
Namespaces feature id (http://xml.org/sax/features/namespaces).

See Also:
Constant Field Values

VALIDATION_FEATURE_ID

protected static final java.lang.String VALIDATION_FEATURE_ID
Validation feature id (http://xml.org/sax/features/validation).

See Also:
Constant Field Values

SCHEMA_VALIDATION_FEATURE_ID

protected static final java.lang.String SCHEMA_VALIDATION_FEATURE_ID
Schema validation feature id (http://apache.org/xml/features/validation/schema).

See Also:
Constant Field Values

SCHEMA_FULL_CHECKING_FEATURE_ID

protected static final java.lang.String SCHEMA_FULL_CHECKING_FEATURE_ID
Schema full checking feature id (http://apache.org/xml/features/validation/schema-full-checking).

See Also:
Constant Field Values

LEXICAL_HANDLER_PROPERTY_ID

protected static final java.lang.String LEXICAL_HANDLER_PROPERTY_ID
Lexical handler property id (http://xml.org/sax/properties/lexical-handler).

See Also:
Constant Field Values

DEFAULT_PARSER_NAME

protected static final java.lang.String DEFAULT_PARSER_NAME
Default parser name.

See Also:
Constant Field Values

DEFAULT_NAMESPACES

protected static final boolean DEFAULT_NAMESPACES
Default namespaces support (true).

See Also:
Constant Field Values

DEFAULT_VALIDATION

protected static final boolean DEFAULT_VALIDATION
Default validation support (false).

See Also:
Constant Field Values

DEFAULT_SCHEMA_VALIDATION

protected static final boolean DEFAULT_SCHEMA_VALIDATION
Default Schema validation support (false).

See Also:
Constant Field Values

DEFAULT_SCHEMA_FULL_CHECKING

protected static final boolean DEFAULT_SCHEMA_FULL_CHECKING
Default Schema full checking support (false).

See Also:
Constant Field Values

DEFAULT_CANONICAL

protected static final boolean DEFAULT_CANONICAL
Default canonical output (false).

See Also:
Constant Field Values

fOut

protected java.io.PrintWriter fOut
Print writer.


fCanonical

protected boolean fCanonical
Canonical output.


printNewlines

protected boolean printNewlines
Print newlines after end elements

Constructor Detail

Writer

public Writer()
Default constructor.


Writer

public Writer(boolean canonical)

Writer

public Writer(boolean canonical,
              boolean printNewlines)
Method Detail

setCanonical

public void setCanonical(boolean canonical)
Sets whether output is canonical.


setOutput

public void setOutput(java.io.OutputStream stream,
                      java.lang.String encoding)
               throws java.io.UnsupportedEncodingException
Sets the output stream for printing.

Throws:
java.io.UnsupportedEncodingException

setOutput

public void setOutput(java.io.Writer writer)
Sets the output writer.


write

public void write(org.w3c.dom.Node node)
Writes the specified node, recursively.


sortAttributes

protected org.w3c.dom.Attr[] sortAttributes(org.w3c.dom.NamedNodeMap attrs)
Returns a sorted list of attributes.


normalizeAndPrint

protected void normalizeAndPrint(java.lang.String s)
Normalizes and prints the given string.


normalizeAndPrint

protected void normalizeAndPrint(char c)
Normalizes and print the given character.