org.apache.woden.ant

## Class XMLWriter

- java.lang.Object
- - org.apache.woden.ant.XMLWriter

- Direct Known Subclasses:
    Report, WsdlCm

      public class XMLWriter
      extends Object

  The `XMLWriter` class writes XML files.
  Author:
    Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMLWriter(PrintWriter out)` Constructs an XML writer.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beginElement(String tag)` Writes the begin tag for an element.
    `void` | `beginElement(String tag, String attributes)` Writes the begin tag for an element with attributes.
    `void` | `close()` Closes the output writer.
    `void` | `element(String tag, String content)` Writes an element with text content.
    `void` | `emptyElement(String tag, String attributes)` Writes an empty element with attributes.
    `void` | `endAllElements()` Write the end tag for all open elements.
    `void` | `endElement()` Writes the end tag for the current element.
    `static String` | `escape(String x)` Replaces the special XML characters a text string with their predefined entities.
    `NamespaceWriter` | `lookup(String namespace)` Looks up a namespace writer for this XML writer.
    `void` | `register(NamespaceWriter writer)` Registers a namespace writer for this XML writer.
    `void` | `write(String tag, boolean value)` Writes a boolean element.
    `void` | `write(String tag, Boolean o)` Writes a Boolean element if non-null.
    `void` | `write(String tag, int value)` Writes an int element.
    `void` | `write(String tag, NCName ncname)` Writes an NCName element if non-null.
    `void` | `write(String tag, String content)` Writes a String element if non-null.
    `void` | `xmlDeclaration(String encoding)` Writes the XML declaration.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XMLWriter

          public XMLWriter(PrintWriter out)

      Constructs an XML writer.
      Parameters:
        `out` - the output writer

  - ### Method Detail

    - #### close

          public void close()

      Closes the output writer.

    - #### xmlDeclaration

          public void xmlDeclaration(String encoding)

      Writes the XML declaration.
      Parameters:
        `encoding` - the character encoding or null

    - #### beginElement

          public void beginElement(String tag)

      Writes the begin tag for an element.
      Parameters:
        `tag` - the tag

    - #### beginElement

          public void beginElement(String tag,
                          String attributes)

      Writes the begin tag for an element with attributes.
      Parameters:
        `tag` - the tag
        `attributes` - the attributes

    - #### endElement

          public void endElement()

      Writes the end tag for the current element.

    - #### endAllElements

          public void endAllElements()

      Write the end tag for all open elements. Call this to produce a well-formed document when execution ends prematurely.

    - #### element

          public void element(String tag,
                     String content)

      Writes an element with text content.
      Parameters:
        `tag` - the tag
        `content` - the content

    - #### emptyElement

          public void emptyElement(String tag,
                          String attributes)

      Writes an empty element with attributes.
      Parameters:
        `tag` - the tag
        `attributes` - the attributes

    - #### write

          public void write(String tag,
                   NCName ncname)

      Writes an NCName element if non-null.
      Parameters:
        `tag` - the tag
        `ncname` - the NCName object or null

    - #### write

          public void write(String tag,
                   String content)

      Writes a String element if non-null.
      Parameters:
        `tag` - the tag
        `content` - the String object or null

    - #### write

          public void write(String tag,
                   Boolean o)

      Writes a Boolean element if non-null.
      Parameters:
        `tag` - the tag
        `o` - the Boolean object or null

    - #### write

          public void write(String tag,
                   boolean value)

      Writes a boolean element.
      Parameters:
        `tag` - the tag
        `value` - the boolean value

    - #### write

          public void write(String tag,
                   int value)

      Writes an int element.
      Parameters:
        `tag` - the tag
        `value` - the int value

    - #### escape

          public static String escape(String x)

      Replaces the special XML characters a text string with their predefined entities.
      Parameters:
        `x` - the text
      Returns:
        the escaped text

    - #### register

          public void register(NamespaceWriter writer)

      Registers a namespace writer for this XML writer.
      Parameters:
        `writer` - the namespace writer

    - #### lookup

          public NamespaceWriter lookup(String namespace)

      Looks up a namespace writer for this XML writer.
      Parameters:
        `namespace` - the namespace to look up
      Returns:
        the namespace writer

Copyright ? Apache Software Foundation. All Rights Reserved.