|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jmatchparser.util.csv.AbstractCSVReader
net.sf.jmatchparser.util.csv.XMLCSVReader
public class XMLCSVReader
Class to read data from an XML file as if it was a CSV (Comma Separated Value) file.
Constructor Summary | |
---|---|
XMLCSVReader(Document doc)
Create a new XMLCSVReader that reads from the given DOM document. |
|
XMLCSVReader(Document doc,
String rowTag,
String... cellTags)
Create a new XMLCSVReader that reads from the given DOM document. |
Method Summary | |
---|---|
void |
close()
Close this reader. |
String[] |
read()
Read a row from this XML file. |
String[] |
read(int[] fileIndex)
Read a row from this XML file. |
Methods inherited from class net.sf.jmatchparser.util.csv.AbstractCSVReader |
---|
read, read, writeTo |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLCSVReader(Document doc)
XMLCSVReader
that reads from the given DOM document.
All child elements of the document element are considered rows, and all
their child elements are considered cells.
doc
- the Document
public XMLCSVReader(Document doc, String rowTag, String... cellTags)
XMLCSVReader
that reads from the given DOM document.
All child elements of the document element that have the row tag as name
(or all of them if the row tag is *
) are considered rows,
and all their child elements that have one of the cell tags as name are
considered cells. In case there is more than one cell tag, the cell tag
in the list of cell tags is used to determine the position in the result
row. If a cell tag matches more than once in a row, all the fields before
the cell tag are added to the result row, and a complete set of empty
fields is used to parse the rest of the row. Cell tags that are not
matched result in empty strings, unless they would be at the end of the
row in the last run.
doc
- the Document
rowTag
- the name of row elementscellTags
- the names of cell elementsMethod Detail |
---|
public void close() throws IOException
close
in class AbstractCSVReader
IOException
public String[] read() throws IOException
read
in class AbstractCSVReader
IOException
public String[] read(int[] fileIndex)
fileIndex
- Array to store the file index to, if needed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |