All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.jclark.xml.output.XMLWriter

java.lang.Object
   |
   +----java.io.Writer
           |
           +----com.jclark.xml.output.XMLWriter

public abstract class XMLWriter
extends Writer
An extension of Writer for writing XML documents. The normal write methods write character data, automatically escaping markup characters.


Constructor Index

 o XMLWriter(Object)

Method Index

 o attribute(String, String)
Writes an attribute.
 o cdataSection(String)
Writes a CDATA section.
 o characterReference(int)
Writes a character reference.
 o comment(String)
Writes a comment.
 o endAttribute()
Ends an attribute.
 o endElement(String)
Ends an element.
 o endReplacementText()
Ends the replacement text for an internal entity.
 o entityReference(boolean, String)
Writes an entity reference.
 o markup(String)
Writes markup.
 o processingInstruction(String, String)
Writes a processing instruction.
 o startAttribute(String)
Starts an attribute.
 o startElement(String)
Starts an element.
 o startReplacementText()
Starts the replacement text for an internal entity.

Constructors

 o XMLWriter
 protected XMLWriter(Object lock)

Methods

 o startElement
 public abstract void startElement(String name) throws IOException
Starts an element. This may be followed by zero or more calls to attribute. The start-tag will be closed by the first following call to any method other than attribute.

 o attribute
 public abstract void attribute(String name,
                                String value) throws IOException
Writes an attribute. This is not legal if there have been calls to methods other than attribute since the last call to startElement, unless inside a startAttribute, endAttribute pair.

 o startAttribute
 public abstract void startAttribute(String name) throws IOException
Starts an attribute. This writes the attribute name, = and the opening quote. This provides an alternative to attribute that allows markup to be included in the attribute value. The value of the attribute is written using the normal write methods; endAttribute must be called at the end of the attribute value. Entity and character references can be written using entityReference and characterReference.

 o endAttribute
 public abstract void endAttribute() throws IOException
Ends an attribute. This writes the closing quote of the attribute value.

 o endElement
 public abstract void endElement(String name) throws IOException
Ends an element. This may output an end-tag or close the current start-tag as an empty element.

 o processingInstruction
 public abstract void processingInstruction(String target,
                                            String data) throws IOException
Writes a processing instruction. If data is non-empty a space will be inserted automatically to separate it from the target.

 o comment
 public abstract void comment(String body) throws IOException
Writes a comment.

 o entityReference
 public abstract void entityReference(boolean isParam,
                                      String name) throws IOException
Writes an entity reference.

 o characterReference
 public abstract void characterReference(int n) throws IOException
Writes a character reference.

 o cdataSection
 public abstract void cdataSection(String content) throws IOException
Writes a CDATA section.

 o startReplacementText
 public abstract void startReplacementText() throws IOException
Starts the replacement text for an internal entity. The replacement text must be ended with endReplacementText. This enables an extra level of escaping that protects against the process of constructing an entity's replacement text from the literal entity value. See Section 4.5 of the XML Recommendation. Between a call to startReplacementText and endReplacementText, the argument to markup would specify entity replacement text; these would be escaped so that when processed as a literal entity value, the specified entity replacement text would be constructed. This call does not itself cause anything to be written.

 o endReplacementText
 public abstract void endReplacementText() throws IOException
Ends the replacement text for an internal entity. This disables the extra level of escaping enabled by startReplacementText. This call does not itself cause anything to be written.

 o markup
 public abstract void markup(String str) throws IOException
Writes markup. The characters in the string will be written as is without being escaped (except for any escaping enabled by startReplacementText).


All Packages  Class Hierarchy  This Package  Previous  Next  Index