    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.

##

XMLWriter(Object)

##

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

##

XMLWriter

     protected XMLWriter(Object lock)

##

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`.

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.

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`.

endAttribute

     public abstract void endAttribute() throws IOException

  Ends an attribute. This writes the closing quote of the attribute value.

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.

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`.

comment

     public abstract void comment(String body) throws IOException

  Writes a comment.

entityReference

     public abstract void entityReference(boolean isParam,
                                          String name) throws IOException

  Writes an entity reference.

characterReference

     public abstract void characterReference(int n) throws IOException

  Writes a character reference.

cdataSection

     public abstract void cdataSection(String content) throws IOException

  Writes a CDATA section.

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.

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.

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