com.g11ntoolkit.domutil
Class XMLWriter

java.lang.Object
  |
  +--java.io.Writer
        |
        +--java.io.PrintWriter
              |
              +--com.g11ntoolkit.domutil.DOMWriter
                    |
                    +--com.g11ntoolkit.domutil.XMLWriter
Direct Known Subclasses:
XHTMLWriter

public class XMLWriter
extends DOMWriter

DOM Document writer as XML format

Version:
$Revision: 1.3 $ $Date: 2005/07/11 23:13:26 $
Copyright © 2005, webMethods, Inc. All rights reserved.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

See License Agreement.

Author:
Masahiko Mori
See Also:
org.w3c.dom

Field Summary
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
XMLWriter(java.io.OutputStream out)
          Create a new XMLWriter, without automatic line flushing, from an existing OutputStream.
XMLWriter(java.io.OutputStream out, boolean autoFlush)
          Create a new XMLWriter from an existing OutputStream.
XMLWriter(java.io.Writer out)
          Create a new XMLWriter, without automatic line flushing.
XMLWriter(java.io.Writer out, boolean autoFlush)
          Create a new XMLWriter.
 
Method Summary
protected  boolean isEmptyElement(org.w3c.dom.Element elm)
          Check empty Element
static void main(java.lang.String[] args)
          Main
protected  java.lang.String normalizer(char c, boolean attmode)
          Normalizer.
protected  java.lang.String normalizer(java.lang.String str, boolean attmode)
          Normalizer.
protected  void write(org.w3c.dom.Attr attr)
          Write out DOM Attribute
protected  void write(org.w3c.dom.CDATASection cdata)
          Write out DOM CDATASection
protected  void write(org.w3c.dom.Comment comment)
          Write out DOM Comment
protected  void write(org.w3c.dom.DocumentFragment docflag)
          Write out DOM DocumentFragment
 void write(org.w3c.dom.Document doc, java.lang.String encoding)
          Write out DOM Document with encoding
protected  void write(org.w3c.dom.DocumentType doctype)
          Write out DOM DocumentType
protected  void write(org.w3c.dom.Element elm)
          Write out DOM Element
protected  void write(org.w3c.dom.Entity entity)
          Write out DOM Entity
protected  void write(org.w3c.dom.EntityReference entityref)
          Write out DOM EntityReference
protected  void write(org.w3c.dom.Notation notation)
          Write out DOM Notation
protected  void write(org.w3c.dom.ProcessingInstruction pi)
          Write out DOM ProcessingInstruction
protected  void write(org.w3c.dom.Text text)
          Write out DOM Text
 
Methods inherited from class com.g11ntoolkit.domutil.DOMWriter
write, write, write, write, writeChilden
 
Methods inherited from class java.io.PrintWriter
checkError, close, flush, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLWriter

public XMLWriter(java.io.OutputStream out)
Create a new XMLWriter, without automatic line flushing, from an existing OutputStream.

Parameters:
out - A character-output stream

XMLWriter

public XMLWriter(java.io.OutputStream out,
                 boolean autoFlush)
Create a new XMLWriter from an existing OutputStream.

Parameters:
out - A character-output stream
autoFlush - A boolean; if true, the println() methods will flush the output buffer

XMLWriter

public XMLWriter(java.io.Writer out)
Create a new XMLWriter, without automatic line flushing.

Parameters:
out - A character-output stream

XMLWriter

public XMLWriter(java.io.Writer out,
                 boolean autoFlush)
Create a new XMLWriter.

Parameters:
out - A character-output stream
autoFlush - A boolean; if true, the println() methods will flush the output buffer
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Main

Parameters:
args - XML File name
java.lang.Exception

write

public void write(org.w3c.dom.Document doc,
                  java.lang.String encoding)
Write out DOM Document with encoding

Overrides:
write in class DOMWriter
Parameters:
doc - Document class
encoding - Output encoding

write

protected void write(org.w3c.dom.Attr attr)
Write out DOM Attribute

Overrides:
write in class DOMWriter
Parameters:
attr - Attribute class

write

protected void write(org.w3c.dom.CDATASection cdata)
Write out DOM CDATASection

Overrides:
write in class DOMWriter
Parameters:
cdata - CDATASection class

write

protected void write(org.w3c.dom.Comment comment)
Write out DOM Comment

Overrides:
write in class DOMWriter
Parameters:
comment - Comment class

write

protected void write(org.w3c.dom.DocumentFragment docflag)
Write out DOM DocumentFragment

Overrides:
write in class DOMWriter
Parameters:
docflag - DocumentFragment class

write

protected void write(org.w3c.dom.DocumentType doctype)
Write out DOM DocumentType

Overrides:
write in class DOMWriter
Parameters:
doctype - DocumentType class

write

protected void write(org.w3c.dom.Element elm)
Write out DOM Element

Overrides:
write in class DOMWriter
Parameters:
elm - Element class

isEmptyElement

protected boolean isEmptyElement(org.w3c.dom.Element elm)
Check empty Element

Parameters:
elm - Element class

write

protected void write(org.w3c.dom.Entity entity)
Write out DOM Entity

Overrides:
write in class DOMWriter
Parameters:
entity - Entity class

write

protected void write(org.w3c.dom.EntityReference entityref)
Write out DOM EntityReference

Overrides:
write in class DOMWriter
Parameters:
entityref - EntityReference class

write

protected void write(org.w3c.dom.Notation notation)
Write out DOM Notation

Overrides:
write in class DOMWriter
Parameters:
notation - Notation class

write

protected void write(org.w3c.dom.ProcessingInstruction pi)
Write out DOM ProcessingInstruction

Overrides:
write in class DOMWriter
Parameters:
pi - ProcessingInstruction class

write

protected void write(org.w3c.dom.Text text)
Write out DOM Text

Overrides:
write in class DOMWriter
Parameters:
text - Text class

normalizer

protected java.lang.String normalizer(java.lang.String str,
                                      boolean attmode)
Normalizer.

Parameters:
str - Input string
attmode - Escape mode

normalizer

protected java.lang.String normalizer(char c,
                                      boolean attmode)
Normalizer.

Parameters:
c - Input character
attmode - Escape mode