class StateElementWriter extends java.lang.Object implements IWritableState
IWritableState
interface.Modifier and Type | Field and Description |
---|---|
private org.w3c.dom.Document |
document |
private org.w3c.dom.Element |
element |
Modifier | Constructor and Description |
---|---|
(package private) |
StateElementWriter(org.w3c.dom.Document document)
Create a writer with an existing XML document.
|
private |
StateElementWriter(org.w3c.dom.Document document,
org.w3c.dom.Element element) |
(package private) |
StateElementWriter(java.lang.String rootName)
Create a writer with a new XML document.
|
Modifier and Type | Method and Description |
---|---|
IWritableState |
createChild(java.lang.String type)
Creates a new child node.
|
void |
putString(java.lang.String key,
java.lang.String value)
Stores a named attribute value.
|
java.lang.String |
toString()
Get the XML document as a string.
|
void |
write(java.io.Writer writer)
Print the XML document to a writer.
|
private final org.w3c.dom.Document document
private final org.w3c.dom.Element element
StateElementWriter(java.lang.String rootName) throws java.io.IOException
rootName
- the name of the XML root elementjava.io.IOException
- if there is a problem creating the XML documentStateElementWriter(org.w3c.dom.Document document)
document
- XML document to write toprivate StateElementWriter(org.w3c.dom.Document document, org.w3c.dom.Element element)
public IWritableState createChild(java.lang.String type)
IWritableState
createChild
in interface IWritableState
type
- node typepublic void putString(java.lang.String key, java.lang.String value)
IWritableState
putString
in interface IWritableState
key
- attribute keyvalue
- attribute valuepublic void write(java.io.Writer writer)
writer
- writer to print the XML document topublic java.lang.String toString()
toString
in class java.lang.Object