Class AbstractXmlParser<T>

  • Type Parameters:
    T - Object type that will be parsed.
    Direct Known Subclasses:
    XJdfParser, XJmfParser

    public abstract class AbstractXmlParser<T>
    extends java.lang.Object
    Parsing logic for building a XML Document from DOM-Tree and the way around.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractXmlParser​(jakarta.xml.bind.JAXBContext jaxbContext)
      Custom constructor.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract AbstractXmlValidator createValidator()
      Create validator for validating documents.
      protected abstract org.glassfish.jaxb.runtime.marshaller.NamespacePrefixMapper getNamespacePrefixMapper()
      Returns a new specific NamespacePrefixMapper implementation.
      protected abstract java.lang.String getXmlHeader()
      Returns the XML Header for marshaling.
      protected void parseNode​(java.lang.Object xmlNode, org.w3c.dom.Node w3cNode)
      Parse an XML Node to a W3C Node.
      protected java.lang.Object parseNode​(org.w3c.dom.Node w3cNode)
      Parse a W3C Node to a XML Node.
      T parseStream​(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 void parseXml​(T obj, java.io.OutputStream os)
      Parse the object tree of an document to a binary output stream.
      protected void parseXml​(T obj, java.io.OutputStream os, boolean skipValidation)
      Parse a object tree to a binary output stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractXmlParser

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

      • parseNode

        protected final java.lang.Object parseNode​(org.w3c.dom.Node w3cNode)
                                            throws jakarta.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:
        jakarta.xml.bind.JAXBException
      • parseNode

        protected final void parseNode​(java.lang.Object xmlNode,
                                       org.w3c.dom.Node w3cNode)
                                throws jakarta.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:
        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.JAXBException
        java.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.IOException
        jakarta.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