public class XmlWriteStream
extends java.lang.Object
Map
sConstructor and Description |
---|
XmlWriteStream(java.io.OutputStream out,
java.lang.String topLabel) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the stream.
|
void |
flush() |
void |
write(java.lang.String name,
java.util.Map<java.lang.Object,java.lang.Object> data)
write data to xml file
|
public XmlWriteStream(java.io.OutputStream out, java.lang.String topLabel) throws javax.xml.stream.XMLStreamException
out
- the OutputStream
topLabel
- the top level element name, typically "Tournament" or
"Session"javax.xml.stream.XMLStreamException
public void write(java.lang.String name, java.util.Map<java.lang.Object,java.lang.Object> data) throws javax.xml.stream.XMLStreamException
name
- the name of the element to write.data
- a xml map of key-value pairs. The hashmap is written as a full
element. Then each pair is checked. If the value is a
Map
, we call write recursively. Otherwise, we convert
the key and value to String
and write that element as
an attribute.
To improve layout, the hashmap's string values are written
first.
If you want to have multiple keys that look identical, use a
Key
as key.javax.xml.stream.XMLStreamException
public void close()
public void flush() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException