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:
Dom4JReader,DomReader,JDom2Reader,JDomReader,XomReader,XppDomReader
public abstract class AbstractDocumentReader extends AbstractXmlReader implements DocumentReader
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classAbstractDocumentReader.Pointer
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDocumentReader(java.lang.Object rootElement)protectedAbstractDocumentReader(java.lang.Object rootElement, NameCoder nameCoder)protectedAbstractDocumentReader(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 voidappendErrors(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).voidclose()Close the reader, if necessary.java.util.IteratorgetAttributeNames()Iterator with the names of the attributes.protected abstract java.lang.ObjectgetChild(int index)protected abstract intgetChildCount()java.lang.ObjectgetCurrent()Retrieve the current processed node of the DOM.protected abstract java.lang.ObjectgetParent()booleanhasMoreChildren()Does the node have any more children remaining that have not yet been read?voidmoveDown()Select the current child as current node.voidmoveUp()Select the parent node as current node.protected abstract voidreassignCurrentElement(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:HierarchicalStreamReaderDoes the node have any more children remaining that have not yet been read?- Specified by:
hasMoreChildrenin interfaceHierarchicalStreamReader
-
moveUp
public void moveUp()
Description copied from interface:HierarchicalStreamReaderSelect the parent node as current node.- Specified by:
moveUpin interfaceHierarchicalStreamReader
-
moveDown
public void moveDown()
Description copied from interface:HierarchicalStreamReaderSelect the current child as current node. A call to this function must be balanced with a call toHierarchicalStreamReader.moveUp().- Specified by:
moveDownin interfaceHierarchicalStreamReader
-
getAttributeNames
public java.util.Iterator getAttributeNames()
Description copied from interface:HierarchicalStreamReaderIterator 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:
getAttributeNamesin interfaceHierarchicalStreamReader
-
appendErrors
public void appendErrors(ErrorWriter errorWriter)
Description copied from interface:HierarchicalStreamReaderIf 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:
appendErrorsin interfaceErrorReporter- Specified by:
appendErrorsin interfaceHierarchicalStreamReader- Parameters:
errorWriter- the error writer
-
getCurrent
public java.lang.Object getCurrent()
Description copied from interface:DocumentReaderRetrieve the current processed node of the DOM.- Specified by:
getCurrentin interfaceDocumentReader- Returns:
- the current node
-
close
public void close()
Description copied from interface:HierarchicalStreamReaderClose the reader, if necessary.- Specified by:
closein interfaceHierarchicalStreamReader
-
-