Package helma.objectmodel.dom
Class XmlWriter
java.lang.Object
java.io.Writer
java.io.OutputStreamWriter
helma.objectmodel.dom.XmlWriter
- All Implemented Interfaces:
XmlConstants
,Closeable
,Flushable
,Appendable
,AutoCloseable
-
Field Summary
FieldsFields inherited from interface helma.objectmodel.dom.XmlConstants
DATEFORMAT, NAMESPACE
-
Constructor Summary
ConstructorsConstructorDescriptionempty constructor, will use System.out as outputstream.Creates a new XmlWriter object.Creates a new XmlWriter object.XmlWriter
(OutputStream out) Creates a new XmlWriter object.XmlWriter
(OutputStream out, String enc) Creates a new XmlWriter object.Creates a new XmlWriter object.Creates a new XmlWriter object. -
Method Summary
Modifier and TypeMethodDescriptionstatic int
create ids that can be used for temporary files.void
setDatabaseMode
(boolean dbmode) void
setIndent
(int ct) set the number of space charsvoid
setMaxLevels
(int levels) by default writing only descends 50 levels into the node tree to prevent infite loops.boolean
starting point for printing a node tree.void
write a hopobject and print all its properties and children.void
void
writeProperty
(IProperty property, String elementName, String propName) write a single property, set attribute type according to type, apply xml-encoding.void
writeReferenceTag
(INode node, String name, String propName) write a tag holding a reference to an element that has been written out before.void
writeTagClose
(String name) write a closing tag for a node e.g.void
writeTagOpen
(INode node, String name, String propName) write an opening tag for a node.Methods inherited from class java.io.OutputStreamWriter
append, append, close, flush, getEncoding, write, write, write
Methods inherited from class java.io.Writer
append, nullWriter, write, write
-
Field Details
-
rootState
public int rootState
-
-
Constructor Details
-
XmlWriter
public XmlWriter()empty constructor, will use System.out as outputstream. -
XmlWriter
Creates a new XmlWriter object.- Parameters:
out
- ...
-
XmlWriter
Creates a new XmlWriter object.- Parameters:
out
- ...enc
- ...- Throws:
UnsupportedEncodingException
- ...
-
XmlWriter
Creates a new XmlWriter object.- Parameters:
desc
- ...- Throws:
FileNotFoundException
- ...
-
XmlWriter
public XmlWriter(String desc, String enc) throws FileNotFoundException, UnsupportedEncodingException Creates a new XmlWriter object.- Parameters:
desc
- ...enc
- ...- Throws:
FileNotFoundException
- ...UnsupportedEncodingException
- ...
-
XmlWriter
Creates a new XmlWriter object.- Parameters:
file
- ...- Throws:
FileNotFoundException
- ...
-
XmlWriter
Creates a new XmlWriter object.- Parameters:
file
- ...enc
- ...- Throws:
FileNotFoundException
- ...UnsupportedEncodingException
- ...
-
-
Method Details
-
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
starting point for printing a node tree. creates document header too and initializes the cache of already converted nodes.- Throws:
IOException
-
write
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:
IOException
-
writeProperty
public void writeProperty(IProperty property, String elementName, String propName) throws IOException write a single property, set attribute type according to type, apply xml-encoding.- Throws:
IOException
-
writeTagOpen
write an opening tag for a node. Include id and prototype, use a name if parameter is non-empty.- Throws:
IOException
-
writeTagClose
write a closing tag for a node e.g.- Throws:
IOException
-
writeReferenceTag
write a tag holding a reference to an element that has been written out before. e.g.- Throws:
IOException
-
writeln
- Parameters:
str
- ...- Throws:
IOException
- ...
-