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 TypeMethodDescriptionvoid
addUnmarshalerListener
(UnmarshalerListener listener) (non-Javadoc)void
close()
Close the reader, if necessary.static DocumentReader
createReader
(File xml, UnmarshalerListener listener) static DocumentReader
createReader
(InputStream xml, UnmarshalerListener listener) void
execute()
(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.int
Number 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.boolean
Does the node have any more children remaining that have not yet been read?boolean
Checks of end of xml document.void
moveDown()
Select the current child as current node.void
moveUp()
Select the parent node as current node.
-
Constructor Details
-
SAXReader
-
-
Method Details
-
close
public void close()Description copied from interface:DocumentReader
Close the reader, if necessary.- Specified by:
close
in interfaceDocumentReader
-
getAttribute
Description copied from interface:DocumentReader
Get the value of an attribute of the current node.- Specified by:
getAttribute
in interfaceDocumentReader
- Parameters:
name
- Name of attribute.
-
getAttribute
Description copied from interface:DocumentReader
Get the value of an attribute of the current node, by index.- Specified by:
getAttribute
in interfaceDocumentReader
- Parameters:
index
- Index of attribute.
-
getAttributeCount
public int getAttributeCount()Description copied from interface:DocumentReader
Number of attributes in current node.- Specified by:
getAttributeCount
in interfaceDocumentReader
-
getAttributeName
Description copied from interface:DocumentReader
Name of attribute in current node.- Specified by:
getAttributeName
in interfaceDocumentReader
-
getNodeName
Description copied from interface:DocumentReader
Get the name of the current node.- Specified by:
getNodeName
in interfaceDocumentReader
-
getValue
Description copied from interface:DocumentReader
Get the value (text content) of the current node.- Specified by:
getValue
in interfaceDocumentReader
-
hasMoreChildren
public boolean hasMoreChildren()Description copied from interface:DocumentReader
Does the node have any more children remaining that have not yet been read?- Specified by:
hasMoreChildren
in interfaceDocumentReader
- Returns:
- True if element has the children nodes.
-
isEndOfDocument
public boolean isEndOfDocument()Description copied from interface:DocumentReader
Checks of end of xml document.- Specified by:
isEndOfDocument
in interfaceDocumentReader
- Returns:
- True if end of document.
-
moveDown
public void moveDown()Description copied from interface:DocumentReader
Select the current child as current node. A call to this function must be balanced with a call toDocumentReader.moveUp()
.- Specified by:
moveDown
in interfaceDocumentReader
-
moveUp
public void moveUp()Description copied from interface:DocumentReader
Select the parent node as current node.- Specified by:
moveUp
in interfaceDocumentReader
-
createReader
-
createReader
-
addUnmarshalerListener
(non-Javadoc)- Specified by:
addUnmarshalerListener
in interfaceDocumentReader
- See Also:
-
execute
public void execute()(non-Javadoc)- Specified by:
execute
in interfaceDocumentReader
- See Also:
-