## helma.objectmodel.dom
Class XmlWriter

    java.lang.Object
      java.io.Writer
          java.io.OutputStreamWriter
              helma.objectmodel.dom.XmlWriter

All Implemented Interfaces:
  XmlConstants, java.io.Closeable, java.io.Flushable, java.lang.Appendable

    public class XmlWriter

extends java.io.OutputStreamWriter
implements XmlConstants

Field Summary
`int` `rootState`

Fields inherited from class java.io.Writer
`lock`

Fields inherited from interface helma.objectmodel.dom.XmlConstants
`DATEFORMAT, NAMESPACE`

Constructor Summary
`XmlWriter()` empty constructor, will use System.out as outputstream.
`XmlWriter(java.io.File file)` Creates a new XmlWriter object.
`XmlWriter(java.io.File file, java.lang.String enc)` Creates a new XmlWriter object.
`XmlWriter(java.io.OutputStream out)` Creates a new XmlWriter object.
`XmlWriter(java.io.OutputStream out, java.lang.String enc)` Creates a new XmlWriter object.
`XmlWriter(java.lang.String desc)` Creates a new XmlWriter object.
`XmlWriter(java.lang.String desc, java.lang.String enc)` Creates a new XmlWriter object.

Method Summary
`static int` `generateID()` create ids that can be used for temporary files.
`void` `setDatabaseMode(boolean dbmode)`
`void` `setIndent(int ct)` set the number of space chars
`void` `setMaxLevels(int levels)` by default writing only descends 50 levels into the node tree to prevent infite loops.
`boolean` `write(INode node)` starting point for printing a node tree.
`void` `write(INode node, java.lang.String elementName, java.lang.String propName, int level)` write a hopobject and print all its properties and children.
`void` `writeln(java.lang.String str)`
`void` `writeProperty(IProperty property, java.lang.String elementName, java.lang.String propName)` write a single property, set attribute type according to type, apply xml-encoding.
`void` `writeReferenceTag(INode node, java.lang.String name, java.lang.String propName)` write a tag holding a reference to an element that has been written out before.
`void` `writeTagClose(java.lang.String name)` write a closing tag for a node e.g.
`void` `writeTagOpen(INode node, java.lang.String name, java.lang.String propName)` write an opening tag for a node.

Methods inherited from class java.io.OutputStreamWriter
`close, flush, getEncoding, write, write, write`

Methods inherited from class java.io.Writer
`append, append, append, write, write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### rootState

    public int rootState

Constructor Detail

### XmlWriter

    public XmlWriter()

  empty constructor, will use System.out as outputstream.

### XmlWriter

    public XmlWriter(java.io.OutputStream out)

  Creates a new XmlWriter object.

  Parameters:
    `out` - ...

### XmlWriter

    public XmlWriter(java.io.OutputStream out,
                     java.lang.String enc)
              throws java.io.UnsupportedEncodingException

  Creates a new XmlWriter object.

  Parameters:
    `out` - ...
    `enc` - ...
  Throws:
    `java.io.UnsupportedEncodingException` - ...

### XmlWriter

    public XmlWriter(java.lang.String desc)
              throws java.io.FileNotFoundException

  Creates a new XmlWriter object.

  Parameters:
    `desc` - ...
  Throws:
    `java.io.FileNotFoundException` - ...

### XmlWriter

    public XmlWriter(java.lang.String desc,
                     java.lang.String enc)
              throws java.io.FileNotFoundException,
                     java.io.UnsupportedEncodingException

  Creates a new XmlWriter object.

  Parameters:
    `desc` - ...
    `enc` - ...
  Throws:
    `java.io.FileNotFoundException` - ...
    `java.io.UnsupportedEncodingException` - ...

### XmlWriter

    public XmlWriter(java.io.File file)
              throws java.io.FileNotFoundException

  Creates a new XmlWriter object.

  Parameters:
    `file` - ...
  Throws:
    `java.io.FileNotFoundException` - ...

### XmlWriter

    public XmlWriter(java.io.File file,
                     java.lang.String enc)
              throws java.io.FileNotFoundException,
                     java.io.UnsupportedEncodingException

  Creates a new XmlWriter object.

  Parameters:
    `file` - ...
    `enc` - ...
  Throws:
    `java.io.FileNotFoundException` - ...
    `java.io.UnsupportedEncodingException` - ...

Method Detail

### generateID

    public static int generateID()

  create ids that can be used for temporary files.

### setMaxLevels

    public void setMaxLevels(int levels)

  by default writing only descends 50 levels into the node tree to prevent infite loops. number can be changed here.

### setDatabaseMode

    public void setDatabaseMode(boolean dbmode)

  Parameters:
    `dbmode` - ...

### setIndent

    public void setIndent(int ct)

  set the number of space chars

### write

    public boolean write(INode node)
                  throws java.io.IOException

  starting point for printing a node tree. creates document header too and initializes the cache of already converted nodes.

  Throws:
    `java.io.IOException`

### write

    public void write(INode node,
                      java.lang.String elementName,
                      java.lang.String propName,
                      int level)
               throws java.io.IOException

  write a hopobject and print all its properties and children. references are made here if a node already has been fully printed or if this is the last level that's going to be dumped

  Throws:
    `java.io.IOException`

### writeProperty

    public void writeProperty(IProperty property,
                              java.lang.String elementName,
                              java.lang.String propName)
                       throws java.io.IOException

  write a single property, set attribute type according to type, apply xml-encoding.

  Throws:
    `java.io.IOException`

### writeTagOpen

    public void writeTagOpen(INode node,
                             java.lang.String name,
                             java.lang.String propName)
                      throws java.io.IOException

  write an opening tag for a node. Include id and prototype, use a name if parameter is non-empty.

  Throws:
    `java.io.IOException`

### writeTagClose

    public void writeTagClose(java.lang.String name)
                       throws java.io.IOException

  write a closing tag for a node e.g. </root>

  Throws:
    `java.io.IOException`

### writeReferenceTag

    public void writeReferenceTag(INode node,
                                  java.lang.String name,
                                  java.lang.String propName)
                           throws java.io.IOException

  write a tag holding a reference to an element that has been written out before. e.g.

  Throws:
    `java.io.IOException`

### writeln

    public void writeln(java.lang.String str)
                 throws java.io.IOException

  Parameters:
    `str` - ...
  Throws:
    `java.io.IOException` - ...

Copyright © 1998-1998-${year} Helma.org. All Rights Reserved.