Package com.thoughtworks.xstream.io.xml
Class DomWriter
- java.lang.Object
-
- com.thoughtworks.xstream.io.AbstractWriter
-
- com.thoughtworks.xstream.io.xml.AbstractXmlWriter
-
- com.thoughtworks.xstream.io.xml.AbstractDocumentWriter
-
- com.thoughtworks.xstream.io.xml.DomWriter
-
- All Implemented Interfaces:
ExtendedHierarchicalStreamWriter
,HierarchicalStreamWriter
,DocumentWriter
,XmlFriendlyWriter
public class DomWriter extends AbstractDocumentWriter
-
-
Field Summary
Fields Modifier and Type Field Description private org.w3c.dom.Document
document
private boolean
hasRootElement
-
Constructor Summary
Constructors Constructor Description DomWriter(org.w3c.dom.Document document)
DomWriter(org.w3c.dom.Document document, NameCoder nameCoder)
DomWriter(org.w3c.dom.Document document, XmlFriendlyReplacer replacer)
Deprecated.As of 1.4 useDomWriter(Document, NameCoder)
instead.DomWriter(org.w3c.dom.Element rootElement)
DomWriter(org.w3c.dom.Element rootElement, NameCoder nameCoder)
DomWriter(org.w3c.dom.Element rootElement, XmlFriendlyReplacer replacer)
Deprecated.As of 1.4 useDomWriter(Element, NameCoder)
instead.DomWriter(org.w3c.dom.Element element, org.w3c.dom.Document document, NameCoder nameCoder)
DomWriter(org.w3c.dom.Element element, org.w3c.dom.Document document, XmlFriendlyReplacer replacer)
Deprecated.As of 1.4 useDomWriter(Element, Document, NameCoder)
instead.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(java.lang.String name, java.lang.String value)
protected java.lang.Object
createNode(java.lang.String name)
Create a node.void
setValue(java.lang.String text)
Write the value (text content) of the current node.private org.w3c.dom.Element
top()
-
Methods inherited from class com.thoughtworks.xstream.io.xml.AbstractDocumentWriter
close, endNode, endNodeInternally, flush, getCurrent, getTopLevelNodes, startNode
-
Methods inherited from class com.thoughtworks.xstream.io.xml.AbstractXmlWriter
escapeXmlName
-
Methods inherited from class com.thoughtworks.xstream.io.AbstractWriter
encodeAttribute, encodeNode, startNode, underlyingWriter
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.thoughtworks.xstream.io.HierarchicalStreamWriter
underlyingWriter
-
-
-
-
Constructor Detail
-
DomWriter
public DomWriter(org.w3c.dom.Document document)
-
DomWriter
public DomWriter(org.w3c.dom.Element rootElement)
-
DomWriter
public DomWriter(org.w3c.dom.Document document, NameCoder nameCoder)
- Since:
- 1.4
-
DomWriter
public DomWriter(org.w3c.dom.Element element, org.w3c.dom.Document document, NameCoder nameCoder)
- Since:
- 1.4
-
DomWriter
public DomWriter(org.w3c.dom.Element rootElement, NameCoder nameCoder)
- Since:
- 1.4
-
DomWriter
public DomWriter(org.w3c.dom.Document document, XmlFriendlyReplacer replacer)
Deprecated.As of 1.4 useDomWriter(Document, NameCoder)
instead.- Since:
- 1.2
-
DomWriter
public DomWriter(org.w3c.dom.Element element, org.w3c.dom.Document document, XmlFriendlyReplacer replacer)
Deprecated.As of 1.4 useDomWriter(Element, Document, NameCoder)
instead.- Since:
- 1.2.1
-
DomWriter
public DomWriter(org.w3c.dom.Element rootElement, XmlFriendlyReplacer replacer)
Deprecated.As of 1.4 useDomWriter(Element, NameCoder)
instead.- Since:
- 1.2
-
-
Method Detail
-
createNode
protected java.lang.Object createNode(java.lang.String name)
Description copied from class:AbstractDocumentWriter
Create a node. The provided node name is not yet XML friendly. IfAbstractDocumentWriter.getCurrent()
returnsnull
the node is a top level node.- Specified by:
createNode
in classAbstractDocumentWriter
- Parameters:
name
- the node name- Returns:
- the new node
-
addAttribute
public void addAttribute(java.lang.String name, java.lang.String value)
-
setValue
public void setValue(java.lang.String text)
Description copied from interface:HierarchicalStreamWriter
Write the value (text content) of the current node.
-
top
private org.w3c.dom.Element top()
-
-