Package com.epam.xml.reader
Class SAXReader
java.lang.Object
com.epam.xml.reader.SAXReader
- All Implemented Interfaces:
DocumentReader
The reader based on SAX parser.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddUnmarshalerListener(UnmarshalerListener listener) (non-Javadoc)voidclose()Close the reader, if necessary.static DocumentReadercreateReader(File xml, UnmarshalerListener listener) static DocumentReadercreateReader(InputStream xml, UnmarshalerListener listener) voidexecute()(non-Javadoc)getAttribute(int index) Get the value of an attribute of the current node, by index.getAttribute(String name) Get the value of an attribute of the current node.intNumber of attributes in current node.getAttributeName(int index) Name of attribute in current node.Get the name of the current node.getValue()Get the value (text content) of the current node.booleanDoes the node have any more children remaining that have not yet been read?booleanChecks of end of xml document.voidmoveDown()Select the current child as current node.voidmoveUp()Select the parent node as current node.
-
Constructor Details
-
SAXReader
-
-
Method Details
-
close
public void close()Description copied from interface:DocumentReaderClose the reader, if necessary.- Specified by:
closein interfaceDocumentReader
-
getAttribute
Description copied from interface:DocumentReaderGet the value of an attribute of the current node.- Specified by:
getAttributein interfaceDocumentReader- Parameters:
name- Name of attribute.
-
getAttribute
Description copied from interface:DocumentReaderGet the value of an attribute of the current node, by index.- Specified by:
getAttributein interfaceDocumentReader- Parameters:
index- Index of attribute.
-
getAttributeCount
public int getAttributeCount()Description copied from interface:DocumentReaderNumber of attributes in current node.- Specified by:
getAttributeCountin interfaceDocumentReader
-
getAttributeName
Description copied from interface:DocumentReaderName of attribute in current node.- Specified by:
getAttributeNamein interfaceDocumentReader
-
getNodeName
Description copied from interface:DocumentReaderGet the name of the current node.- Specified by:
getNodeNamein interfaceDocumentReader
-
getValue
Description copied from interface:DocumentReaderGet the value (text content) of the current node.- Specified by:
getValuein interfaceDocumentReader
-
hasMoreChildren
public boolean hasMoreChildren()Description copied from interface:DocumentReaderDoes the node have any more children remaining that have not yet been read?- Specified by:
hasMoreChildrenin interfaceDocumentReader- Returns:
- True if element has the children nodes.
-
isEndOfDocument
public boolean isEndOfDocument()Description copied from interface:DocumentReaderChecks of end of xml document.- Specified by:
isEndOfDocumentin interfaceDocumentReader- Returns:
- True if end of document.
-
moveDown
public void moveDown()Description copied from interface:DocumentReaderSelect the current child as current node. A call to this function must be balanced with a call toDocumentReader.moveUp().- Specified by:
moveDownin interfaceDocumentReader
-
moveUp
public void moveUp()Description copied from interface:DocumentReaderSelect the parent node as current node.- Specified by:
moveUpin interfaceDocumentReader
-
createReader
-
createReader
-
addUnmarshalerListener
(non-Javadoc)- Specified by:
addUnmarshalerListenerin interfaceDocumentReader- See Also:
-
execute
public void execute()(non-Javadoc)- Specified by:
executein interfaceDocumentReader- See Also:
-