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 Object
Parsing logic for building a XML Document from DOM-Tree and the way around.
  • Constructor Details

    • AbstractXmlParser

      protected AbstractXmlParser(javax.xml.bind.JAXBContext jaxbContext)
      Custom constructor. Accepting a JAXBContextFactory for initializing.
      Parameters:
      jaxbContext - Context for JAXB-Handling.
  • Method Details

    • parseNode

      protected final Object parseNode(Node w3cNode) throws javax.xml.bind.JAXBException
      Parse a W3C Node to a XML Node.
      Parameters:
      w3cNode - The W3C Node to be parsed.
      Returns:
      The XML Node as object.
      Throws:
      javax.xml.bind.JAXBException
    • parseNode

      protected final void parseNode(Object xmlNode, Node w3cNode) throws javax.xml.bind.JAXBException
      Parse an XML Node to a W3C Node.
      Parameters:
      xmlNode - The XML Node to be parsed.
      w3cNode - The W3C Result node.
      Throws:
      javax.xml.bind.JAXBException
    • parseXml

      protected final byte[] parseXml(T obj) throws javax.xml.bind.JAXBException, 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:
      javax.xml.bind.JAXBException
      IOException
    • parseXml

      protected final void parseXml(T obj, OutputStream os) throws javax.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:
      javax.xml.bind.ValidationException - Is thrown in case document is not valid and validation process is not being skipped.
      javax.xml.bind.JAXBException
    • parseXml

      protected final byte[] parseXml(T obj, boolean skipValidation) throws IOException, javax.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:
      IOException
      javax.xml.bind.JAXBException
    • parseXml

      protected final void parseXml(T obj, OutputStream os, boolean skipValidation) throws javax.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:
      javax.xml.bind.ValidationException - Is thrown in case the document is not valid and validation process is not being skipped.
      javax.xml.bind.JAXBException
    • parseStream

      public final T parseStream(InputStream is) throws javax.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:
      javax.xml.bind.JAXBException
    • getNamespacePrefixMapper

      protected abstract com.sun.xml.bind.marshaller.NamespacePrefixMapper getNamespacePrefixMapper()
      Returns a new specific NamespacePrefixMapper implementation.
      Returns:
      New specific NamespacePrefixMapper implementation.
    • getXmlHeader

      protected abstract 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