com.lifecde.jxm
Class XMLWriter

java.lang.Object
  |
  +--com.lifecde.jxm.XMLWriter

public class XMLWriter
extends java.lang.Object

XMLWriter knows how to write elements and attributes, and how to use indenting.

Author:
Brian King (brian.king@lifecde.com)

Nested Class Summary
protected  class XMLWriter.Indent
          Implements indenting for elements.
protected  class XMLWriter.PCDATAFilterWriter
          Write XML PCDATA using entity substitutions.
 
Field Summary
protected static int ATTRIBUTE
          writing attributes
protected static int CONTENT
          writing content
protected static int END
          wrote end
protected  XMLWriter.Indent indent
          indent
static java.lang.String INDENT
          use a two space indent
protected  XMLWriter.PCDATAFilterWriter mFilter
          writes PCDATA replacing XML characters with escape entities
protected  java.io.PrintWriter mOut
          Write to XML document
protected static int START
          wrote start
protected  int state
          current state
 
Constructor Summary
XMLWriter(java.io.Writer out)
           
 
Method Summary
 void attribute(java.lang.String name, boolean value)
           
 void attribute(java.lang.String name, int value)
           
 void attribute(java.lang.String name, java.lang.Object value)
           
 void attribute(java.lang.String name, java.lang.String value)
           
 void content(java.lang.String content)
           
 void end(java.lang.String name)
          Write end tag.
 void start(java.lang.String name)
          Write start tag.
 void writeDocumentType(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          Write a DOCTYPE
 void xmlHeader()
          Write <?xml version="1.0"?>
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDENT

public static final java.lang.String INDENT
use a two space indent

See Also:
Constant Field Values

CONTENT

protected static final int CONTENT
writing content

See Also:
Constant Field Values

START

protected static final int START
wrote start

See Also:
Constant Field Values

ATTRIBUTE

protected static final int ATTRIBUTE
writing attributes

See Also:
Constant Field Values

END

protected static final int END
wrote end

See Also:
Constant Field Values

mOut

protected java.io.PrintWriter mOut
Write to XML document


indent

protected XMLWriter.Indent indent
indent


mFilter

protected XMLWriter.PCDATAFilterWriter mFilter
writes PCDATA replacing XML characters with escape entities


state

protected int state
current state

Constructor Detail

XMLWriter

public XMLWriter(java.io.Writer out)
Method Detail

xmlHeader

public void xmlHeader()
Write <?xml version="1.0"?>


writeDocumentType

public void writeDocumentType(java.lang.String name,
                              java.lang.String publicId,
                              java.lang.String systemId)
Write a DOCTYPE

Parameters:
name - document type name
publicId - public Id. May be Null.
systemId - system Id.

attribute

public void attribute(java.lang.String name,
                      int value)
               throws java.io.IOException
java.io.IOException

attribute

public void attribute(java.lang.String name,
                      boolean value)
               throws java.io.IOException
java.io.IOException

attribute

public void attribute(java.lang.String name,
                      java.lang.Object value)
               throws java.io.IOException
java.io.IOException

attribute

public void attribute(java.lang.String name,
                      java.lang.String value)
               throws java.io.IOException
java.io.IOException

content

public void content(java.lang.String content)
             throws java.io.IOException
java.io.IOException

start

public void start(java.lang.String name)
Write start tag.


end

public void end(java.lang.String name)
Write end tag.