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.Loggerlogprotected javax.xml.bind.Unmarshallerumprotected XMLInputFactoryxmlifprotected XMLStreamReaderxmlr
-
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 booleancontains(String[] elements, String localName)ObjectgetObject(String... elements)This method will return either the object or null if we hit the end of stream before getting another instance.voidsetSchema(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.JAXBExceptionXMLStreamException
-
EDmvParser
public EDmvParser(Class<?>[] rootTypes, InputStream is) throws javax.xml.bind.JAXBException, XMLStreamException
- Throws:
javax.xml.bind.JAXBExceptionXMLStreamException
-
-
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:
XMLStreamExceptionjavax.xml.bind.JAXBException
-
-