Package ejava.projects.edmv.xml
Class EDmvParser
- java.lang.Object
-
- ejava.projects.edmv.xml.EDmvParser
-
public class EDmvParser extends Object
This class will read in Java objects from a specified XML file. These objects can be used to create ingest data for projects.
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.Logger
log
protected javax.xml.bind.Unmarshaller
um
protected XMLInputFactory
xmlif
protected XMLStreamReader
xmlr
-
Constructor Summary
Constructors Constructor Description EDmvParser(Class<?>[] rootTypes, InputStream is)
EDmvParser(Class<?> rootType, InputStream is)
Pass in the JAXB class that represents the root node of the document and an InputStream for the document to parse.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
contains(String[] elements, String localName)
Object
getObject(String... elements)
This method will return either the object or null if we hit the end of stream before getting another instance.void
setSchema(InputStream schema)
-
-
-
Field Detail
-
log
private org.slf4j.Logger log
-
xmlif
protected XMLInputFactory xmlif
-
um
protected javax.xml.bind.Unmarshaller um
-
xmlr
protected XMLStreamReader xmlr
-
-
Constructor Detail
-
EDmvParser
public EDmvParser(Class<?> rootType, InputStream is) throws javax.xml.bind.JAXBException, XMLStreamException
Pass in the JAXB class that represents the root node of the document and an InputStream for the document to parse.- Parameters:
rootType
- - the class of the root typeis
- - am input stream with document to parse- Throws:
javax.xml.bind.JAXBException
XMLStreamException
-
EDmvParser
public EDmvParser(Class<?>[] rootTypes, InputStream is) throws javax.xml.bind.JAXBException, XMLStreamException
- Throws:
javax.xml.bind.JAXBException
XMLStreamException
-
-
Method Detail
-
setSchema
public void setSchema(InputStream schema) throws SAXException
- Throws:
SAXException
-
getObject
public Object getObject(String... elements) throws XMLStreamException, javax.xml.bind.JAXBException
This method will return either the object or null if we hit the end of stream before getting another instance. Note that only the local-name is being used. That won't work to great when two namespaces declare a common local-name. Should be easily fixable when needed.- Parameters:
elements
-- Returns:
- Throws:
XMLStreamException
javax.xml.bind.JAXBException
-
-