Package com.thoughtworks.xstream.io.xml
Class AbstractDocumentReader
- java.lang.Object
-
- com.thoughtworks.xstream.io.AbstractReader
-
- com.thoughtworks.xstream.io.xml.AbstractXmlReader
-
- com.thoughtworks.xstream.io.xml.AbstractDocumentReader
-
- All Implemented Interfaces:
ErrorReporter
,ExtendedHierarchicalStreamReader
,HierarchicalStreamReader
,DocumentReader
- Direct Known Subclasses:
DomReader
,XppDomReader
public abstract class AbstractDocumentReader extends AbstractXmlReader implements DocumentReader
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
AbstractDocumentReader.Pointer
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDocumentReader(java.lang.Object rootElement)
protected
AbstractDocumentReader(java.lang.Object rootElement, NameCoder nameCoder)
protected
AbstractDocumentReader(java.lang.Object rootElement, XmlFriendlyReplacer replacer)
Deprecated.As of 1.4, useAbstractDocumentReader(Object, NameCoder)
instead.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
appendErrors(ErrorWriter errorWriter)
If any errors are detected, allow the reader to add any additional information that can aid debugging (such as line numbers, XPath expressions, etc).void
close()
Close the reader, if necessary.java.util.Iterator
getAttributeNames()
Iterator with the names of the attributes.protected abstract java.lang.Object
getChild(int index)
protected abstract int
getChildCount()
java.lang.Object
getCurrent()
Retrieve the current processed node of the DOM.protected abstract java.lang.Object
getParent()
boolean
hasMoreChildren()
Does the node have any more children remaining that have not yet been read?void
moveDown()
Select the current child as current node.void
moveUp()
Select the parent node as current node.protected abstract void
reassignCurrentElement(java.lang.Object current)
-
Methods inherited from class com.thoughtworks.xstream.io.xml.AbstractXmlReader
escapeXmlName, unescapeXmlName
-
Methods inherited from class com.thoughtworks.xstream.io.AbstractReader
decodeAttribute, decodeNode, encodeAttribute, encodeNode, peekNextChild, underlyingReader
-
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.HierarchicalStreamReader
getAttribute, getAttribute, getAttributeCount, getAttributeName, getNodeName, getValue, underlyingReader
-
-
-
-
Field Detail
-
pointers
private FastStack pointers
-
current
private java.lang.Object current
-
-
Constructor Detail
-
AbstractDocumentReader
protected AbstractDocumentReader(java.lang.Object rootElement)
-
AbstractDocumentReader
protected AbstractDocumentReader(java.lang.Object rootElement, NameCoder nameCoder)
- Since:
- 1.4
-
AbstractDocumentReader
protected AbstractDocumentReader(java.lang.Object rootElement, XmlFriendlyReplacer replacer)
Deprecated.As of 1.4, useAbstractDocumentReader(Object, NameCoder)
instead.- Since:
- 1.2
-
-
Method Detail
-
reassignCurrentElement
protected abstract void reassignCurrentElement(java.lang.Object current)
-
getParent
protected abstract java.lang.Object getParent()
-
getChild
protected abstract java.lang.Object getChild(int index)
-
getChildCount
protected abstract int getChildCount()
-
hasMoreChildren
public boolean hasMoreChildren()
Description copied from interface:HierarchicalStreamReader
Does the node have any more children remaining that have not yet been read?- Specified by:
hasMoreChildren
in interfaceHierarchicalStreamReader
-
moveUp
public void moveUp()
Description copied from interface:HierarchicalStreamReader
Select the parent node as current node.- Specified by:
moveUp
in interfaceHierarchicalStreamReader
-
moveDown
public void moveDown()
Description copied from interface:HierarchicalStreamReader
Select the current child as current node. A call to this function must be balanced with a call toHierarchicalStreamReader.moveUp()
.- Specified by:
moveDown
in interfaceHierarchicalStreamReader
-
getAttributeNames
public java.util.Iterator getAttributeNames()
Description copied from interface:HierarchicalStreamReader
Iterator with the names of the attributes.Note, the iterator is only valid as long as the internal state of the underlying parser is still at the start of the current element. The behavior is undefined if the parser moved on.
- Specified by:
getAttributeNames
in interfaceHierarchicalStreamReader
-
appendErrors
public void appendErrors(ErrorWriter errorWriter)
Description copied from interface:HierarchicalStreamReader
If any errors are detected, allow the reader to add any additional information that can aid debugging (such as line numbers, XPath expressions, etc).- Specified by:
appendErrors
in interfaceErrorReporter
- Specified by:
appendErrors
in interfaceHierarchicalStreamReader
- Parameters:
errorWriter
- the error writer
-
getCurrent
public java.lang.Object getCurrent()
Description copied from interface:DocumentReader
Retrieve the current processed node of the DOM.- Specified by:
getCurrent
in interfaceDocumentReader
- Returns:
- the current node
-
close
public void close()
Description copied from interface:HierarchicalStreamReader
Close the reader, if necessary.- Specified by:
close
in interfaceHierarchicalStreamReader
-
-