public class XmlReader extends Object implements RecordReader
A XmlReader makes use of the DOM user data feature to pass additional information to and from the parser. The GROUP_COUNT is an Integer value added to elements in the base document to indicate the number of times an element was read from the input stream. And the IS_NAMESPACE_IGNORED is a Boolean value set on elements in the base document where the XML namespace should not be used to match nodes read from the input stream.
The method getRecordText() is not currently supported.
Modifier and Type | Field and Description |
---|---|
static String |
GROUP_COUNT
The DOM user data key to obtain the number of times a group element was
read in the base document as a java.lang.Integer.
|
static String |
IS_NAMESPACE_IGNORED
The DOM user data key to indicate whether the namespace of an element in
the base document is ignored when matching nodes read from an input stream.
|
Constructor and Description |
---|
XmlReader(Reader reader)
Constructs a new XmlReader.
|
XmlReader(Reader reader,
Document base)
Constructs a new XmlReader.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this input stream.
|
int |
getRecordLineNumber()
Returns the line number of the last record from this input stream.
|
String |
getRecordText()
Returns the unparsed record text of the last record read.
|
Document |
read()
Reads a single record from this input stream.
|
public static final String GROUP_COUNT
public static final String IS_NAMESPACE_IGNORED
public XmlReader(Reader reader)
reader
- the input stream to read frompublic Document read() throws IOException, RecordIOException
RecordReader
read
in interface RecordReader
IOException
- if an I/O error occurs reading from the streamRecordIOException
- if the record is malformed and cannot
be parsed, but subsequent reads may still be possiblepublic void close() throws IOException
RecordReader
close
in interface RecordReader
IOException
- if an I/O error occurs closing the streampublic int getRecordLineNumber()
RecordReader
getRecordLineNumber
in interface RecordReader
public String getRecordText()
RecordReader
getRecordText
in interface RecordReader