public class XmlDocReader extends java.lang.Object implements FormatReader<DocData>
Constructor and Description |
---|
XmlDocReader()
Create a new XmlDocReader.
|
XmlDocReader(java.io.File xmlFile)
Create a new XML Document reader for the specified file
|
XmlDocReader(java.net.URL url)
Create a new XML document reader for the specified URL
|
Modifier and Type | Method and Description |
---|---|
boolean |
canRead()
Return if this reader can read.
|
void |
close()
close the reader
|
java.lang.String |
getFilters()
Get the filters for this reader.
|
java.lang.String |
getSource()
Get the source for the reader
|
boolean |
hasMoreData()
Return whether this reader has more data to read
|
protected void |
parseDocElem(org.w3c.dom.Element elem,
DocData doc)
Extensible method which performs any special processing on a particular
element and its associated document.
|
java.util.List<DocData> |
readData()
Read the data, creating DocData elements.
|
void |
setFilters(java.lang.String filters)
Set filters for this reader.
|
void |
setSource(java.lang.String source)
Set the soruce for this reader
|
public XmlDocReader()
public XmlDocReader(java.io.File xmlFile)
xmlFile
- the XML file to readpublic XmlDocReader(java.net.URL url)
url
- the url to read frompublic boolean canRead()
canRead
in interface FormatReader<DocData>
public void close()
close
in interface FormatReader<DocData>
public java.lang.String getFilters()
getFilters
in interface FormatReader<DocData>
public java.lang.String getSource()
getSource
in interface FormatReader<DocData>
public boolean hasMoreData()
hasMoreData
in interface FormatReader<DocData>
protected void parseDocElem(org.w3c.dom.Element elem, DocData doc)
elem
- the element to parsedoc
- the DocData objectpublic java.util.List<DocData> readData()
readData
in interface FormatReader<DocData>
public void setFilters(java.lang.String filters)
setFilters
in interface FormatReader<DocData>
filters
- the set of filterspublic void setSource(java.lang.String source)
setSource
in interface FormatReader<DocData>
source
- the source. This method attempts to open the source first
as a URL, then as a local file. If neither works, it throws
an IllegalArgumentException