|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.hpi.fgis.dude.util.AbstractCleanable de.hpi.fgis.dude.datasource.AbstractDataSource<XMLSource> de.hpi.fgis.dude.datasource.XMLSource
public class XMLSource
XMLSource
represents *.xml files.
Nested Class Summary | |
---|---|
protected class |
XMLSource.XMLSourceIterator
XMLSourceIterator is used for generating DuDeObject s out of XMLSource s. |
Nested classes/interfaces inherited from class de.hpi.fgis.dude.datasource.AbstractDataSource |
---|
AbstractDataSource.AbstractDataSourceIterator<T extends AbstractDataSource<?>> |
Constructor Summary | |
---|---|
protected |
XMLSource()
Internal constructor for Jsonable deserialization. |
|
XMLSource(String identifier,
File file)
Initializes a XMLSource that converts all elements in the first XML layer into JsonRecord s. |
|
XMLSource(String identifier,
File file,
String root)
Initializes a XMLSource that converts all direct child elements of the given root into DuDeObject s. |
Method Summary | |
---|---|
void |
cleanUp()
Closes all registered Closeable and Cleanable instances. |
protected XMLStreamReader |
createXMLStreamReader()
Instantiates a new XMLStreamReader . |
void |
fromJson(DuDeJsonParser<?> jsonParser)
Initializes the current instance using the passed DuDeJsonParser . |
protected String |
getRootElementTag()
Returns the set root element or null , if no root was set. |
Iterator<DuDeObject> |
iterator()
|
protected boolean |
rootIsSet()
Checks whether a root element was set. |
void |
toJson(DuDeJsonGenerator jsonGenerator)
Generates the Json code using the passed DuDeJsonGenerator . |
Methods inherited from class de.hpi.fgis.dude.datasource.AbstractDataSource |
---|
addIdAttributes, autoGeneratedIds, close, equals, getExtractedRecordCount, getIdAttributes, getIdentifier, hashCode, setExtractedRecordCount, toString, withIdAttributes |
Methods inherited from class de.hpi.fgis.dude.util.AbstractCleanable |
---|
registerCleanable, registerCloseable |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface de.hpi.fgis.dude.util.Cleanable |
---|
registerCleanable, registerCloseable |
Constructor Detail |
---|
protected XMLSource()
Jsonable
deserialization.
public XMLSource(String identifier, File file) throws FileNotFoundException
XMLSource
that converts all elements in the first XML layer into JsonRecord
s.
identifier
- The identifier of the DataSource
instance.file
- The XML file from which the data shall be extracted.
FileNotFoundException
- If the passed file does not exist.public XMLSource(String identifier, File file, String root) throws FileNotFoundException
XMLSource
that converts all direct child elements of the given root into DuDeObject
s.
identifier
- The identifier of the DataSource
instance.file
- The XML file from which the data shall be extracted.root
- The tag of the element, of which the child elements will be extracted.
FileNotFoundException
- If the passed file does not exist.Method Detail |
---|
public void cleanUp()
Cleanable
Closeable
and Cleanable
instances.
cleanUp
in interface Cleanable
cleanUp
in class AbstractCleanable
protected XMLStreamReader createXMLStreamReader() throws XMLStreamException
XMLStreamReader
.
XMLStreamReader
.
XMLStreamException
- If an error occurred while instantiating the XMLStreamReader
.protected boolean rootIsSet()
true
, if a root element was set; otherwise false
.protected String getRootElementTag()
null
, if no root was set.
public Iterator<DuDeObject> iterator()
iterator
in interface Iterable<DuDeObject>
iterator
in class AbstractDataSource<XMLSource>
public void toJson(DuDeJsonGenerator jsonGenerator) throws org.codehaus.jackson.JsonGenerationException, IOException
Jsonable
DuDeJsonGenerator
.
toJson
in interface Jsonable
jsonGenerator
- The DuDeJsonGenerator
that is used internally.
org.codehaus.jackson.JsonGenerationException
- If an error occurs while generating the Json syntax.
IOException
- If an error occurs while writing to the output.public void fromJson(DuDeJsonParser<?> jsonParser) throws org.codehaus.jackson.JsonParseException, IOException
Jsonable
DuDeJsonParser
.
fromJson
in interface Jsonable
jsonParser
- The parser that is used for extracting the data out of the Json.
org.codehaus.jackson.JsonParseException
- If an error occurs while parsing the Json.
IOException
- If an error occurs while reading from the stream.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |