Package org.cip4.lib.xjdf.xml.internal
Class AbstractXmlParser<T>
- java.lang.Object
-
- org.cip4.lib.xjdf.xml.internal.AbstractXmlParser<T>
-
- Type Parameters:
T- Object type that will be parsed.
- Direct Known Subclasses:
XJdfParser,XJmfParser
public abstract class AbstractXmlParser<T> extends java.lang.ObjectParsing logic for building a XML Document from DOM-Tree and the way around.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractXmlParser(jakarta.xml.bind.JAXBContext jaxbContext)Custom constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract AbstractXmlValidatorcreateValidator()Create validator for validating documents.protected abstract org.glassfish.jaxb.runtime.marshaller.NamespacePrefixMappergetNamespacePrefixMapper()Returns a new specific NamespacePrefixMapper implementation.protected abstract java.lang.StringgetXmlHeader()Returns the XML Header for marshaling.protected voidparseNode(java.lang.Object xmlNode, org.w3c.dom.Node w3cNode)Parse an XML Node to a W3C Node.protected java.lang.ObjectparseNode(org.w3c.dom.Node w3cNode)Parse a W3C Node to a XML Node.TparseStream(java.io.InputStream is)Parse a binary input stream to a object tree.protected byte[]parseXml(T obj)Parse the object tree of an document to a byte array.protected byte[]parseXml(T obj, boolean skipValidation)Parse a object tree to a byte array.protected voidparseXml(T obj, java.io.OutputStream os)Parse the object tree of an document to a binary output stream.protected voidparseXml(T obj, java.io.OutputStream os, boolean skipValidation)Parse a object tree to a binary output stream.
-
-
-
Method Detail
-
parseNode
protected final java.lang.Object parseNode(org.w3c.dom.Node w3cNode) throws jakarta.xml.bind.JAXBExceptionParse a W3C Node to a XML Node.- Parameters:
w3cNode- The W3C Node to be parsed.- Returns:
- The XML Node as object.
- Throws:
jakarta.xml.bind.JAXBException
-
parseNode
protected final void parseNode(java.lang.Object xmlNode, org.w3c.dom.Node w3cNode) throws jakarta.xml.bind.JAXBExceptionParse an XML Node to a W3C Node.- Parameters:
xmlNode- The XML Node to be parsed.w3cNode- The W3C Result node.- Throws:
jakarta.xml.bind.JAXBException
-
parseXml
protected final byte[] parseXml(T obj) throws jakarta.xml.bind.JAXBException, java.io.IOException
Parse the object tree of an document to a byte array.- Parameters:
obj- Object tree for parsing.- Returns:
- XML-representation of the document as array of bytes.
- Throws:
jakarta.xml.bind.JAXBExceptionjava.io.IOException
-
parseXml
protected final void parseXml(T obj, java.io.OutputStream os) throws jakarta.xml.bind.JAXBException
Parse the object tree of an document to a binary output stream.- Parameters:
obj- Object tree for parsing.os- OutputStream the write the document to.- Throws:
jakarta.xml.bind.ValidationException- Is thrown in case document is not valid and validation process is not being skipped.jakarta.xml.bind.JAXBException
-
parseXml
protected final byte[] parseXml(T obj, boolean skipValidation) throws java.io.IOException, jakarta.xml.bind.JAXBException
Parse a object tree to a byte array.- Parameters:
obj- Object tree for parsing.skipValidation- Skip validation.- Returns:
- Document as Byte Array.
- Throws:
java.io.IOExceptionjakarta.xml.bind.JAXBException
-
parseXml
protected final void parseXml(T obj, java.io.OutputStream os, boolean skipValidation) throws jakarta.xml.bind.JAXBException
Parse a object tree to a binary output stream.- Parameters:
obj- Object tree object for parsing.os- Target OutputStream where document is being parsed.skipValidation- Indicates whether or not validation has to be skipped.- Throws:
jakarta.xml.bind.ValidationException- Is thrown in case the document is not valid and validation process is not being skipped.jakarta.xml.bind.JAXBException
-
parseStream
public final T parseStream(java.io.InputStream is) throws jakarta.xml.bind.JAXBException
Parse a binary input stream to a object tree.- Parameters:
is- Binary document input stream for parsing.- Returns:
- Object tree parsed from binary input stream.
- Throws:
jakarta.xml.bind.JAXBException
-
getNamespacePrefixMapper
protected abstract org.glassfish.jaxb.runtime.marshaller.NamespacePrefixMapper getNamespacePrefixMapper()
Returns a new specific NamespacePrefixMapper implementation.- Returns:
- New specific NamespacePrefixMapper implementation.
-
getXmlHeader
protected abstract java.lang.String getXmlHeader()
Returns the XML Header for marshaling.- Returns:
- XML Header as String
-
createValidator
protected abstract AbstractXmlValidator createValidator()
Create validator for validating documents.- Returns:
- Validator
-
-