be.ehealth.technicalconnector.utils

## Class ConnectorXmlUtils

- java.lang.Object
- - be.ehealth.technicalconnector.utils.ConnectorXmlUtils

-     public final class ConnectorXmlUtils
      extends Object

  Utility class to parse JAXB objects

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `dump(Object obj)` Logs a JAXB object as an XML String Debug logging needs to be activated
    `static String` | `flatten(String xml)` Removes tabs, line feeds and whitespaces between elements.
    `static String` | `format(String unformattedXml)` Method to format/indent a XML string
    `static String` | `format(String unformattedXml, Source xslt)` Method to format/indent a XML String and applying an XSLT tranformation.
    `static DocumentBuilder` | `getDocumentBuilder()`
    `static Element` | `getFirstChildElement(Node node)`
    `static Element` | `getFirstElementByTagNameNS(Element node, String namespaceURI, String localName)`
    `static String` | `sanitizePartId(String contentId)`
    `static byte[]` | `toByteArray(Node node)` Parse the node to an byte[]
    `static byte[]` | `toByteArray(Object obj)` Parse the object to an byte[]
    `static Document` | `toDocument(byte[] data)`
    `static Document` | `toDocument(Object obj)` Parse the JAXB object to a `Document`
    `static Document` | `toDocument(Source source)`
    `static Document` | `toDocument(String xml)` To `Document` based on a `String`
    `static Element` | `toElement(byte[] data)` To `Element` based on a byte[]
    `static <T> T` | `toObject(byte[] in, Class<T> clazz)`
    `static <T> T` | `toObject(InputStream in, Class<T> clazz)` Convert an InputStream to the given JAXB Element.
    `static <T> T` | `toObject(String xml, Class<T> clazz)` Convert a xml String to the given JAXB Element.
    `static String` | `toString(Node node)` To string based on a `Node`
    `static String` | `toString(Object obj)` To string based on a JAXB object
    `static String` | `toString(Source source)` To string based on a `Source`
    `static String` | `xslt(Source doc, Source xslt)` Method to format/indent a XML and applying an XSLT tranformation.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getDocumentBuilder

          public static DocumentBuilder getDocumentBuilder()

    - #### getFirstElementByTagNameNS

          public static Element getFirstElementByTagNameNS(Element node,
                                                           String namespaceURI,
                                                           String localName)

    - #### getFirstChildElement

          public static Element getFirstChildElement(Node node)

    - #### dump

          public static void dump(Object obj)

      Logs a JAXB object as an XML String Debug logging needs to be activated
      Parameters:
        `obj` - the object to log

    - #### toByteArray

          public static byte[] toByteArray(Node node)

      Parse the node to an byte[]
      Returns:
        String the XML string

    - #### toByteArray

          public static byte[] toByteArray(Object obj)

      Parse the object to an byte[]
      Parameters:
        `obj` - the object to parse
      Returns:
        String the XML string

    - #### toDocument

          public static Document toDocument(byte[] data)
                                     throws TechnicalConnectorException

      Parameters:
        `data` -
      Returns:
      Throws:
        `TechnicalConnectorException`

    - #### toDocument

          public static Document toDocument(Source source)
                                     throws TechnicalConnectorException

      Throws:
        `TechnicalConnectorException`

    - #### toDocument

          public static Document toDocument(Object obj)

      Parse the JAXB object to a `Document`

    - #### toDocument

          public static Document toDocument(String xml)
                                     throws TechnicalConnectorException

      To `Document` based on a `String`
      Throws:
        `TechnicalConnectorException`

    - #### toElement

          public static Element toElement(byte[] data)
                                   throws TechnicalConnectorException

      To `Element` based on a byte[]
      Throws:
        `TechnicalConnectorException`

    - #### toObject

          public static <T> T toObject(InputStream in,
                                       Class<T> clazz)

      Convert an InputStream to the given JAXB Element.

    - #### toObject

          public static <T> T toObject(byte[] in,
                                       Class<T> clazz)

    - #### toObject

          public static <T> T toObject(String xml,
                                       Class<T> clazz)

      Convert a xml String to the given JAXB Element.

    - #### toString

          public static String toString(Object obj)

      To string based on a JAXB object

    - #### toString

          public static String toString(Node node)
                                 throws TechnicalConnectorException

      To string based on a `Node`
      Throws:
        `TechnicalConnectorException`

    - #### toString

          public static String toString(Source source)
                                 throws TechnicalConnectorException

      To string based on a `Source`
      Throws:
        `TechnicalConnectorException`

    - #### flatten

          public static String flatten(String xml)

      Removes tabs, line feeds and whitespaces between elements.

    - #### format

          public static String format(String unformattedXml)

      Method to format/indent a XML string
      Parameters:
        `unformattedXml` -
      Returns:

    - #### format

          public static String format(String unformattedXml,
                                      Source xslt)

      Method to format/indent a XML String and applying an XSLT tranformation.
      Parameters:
        `unformattedXml` -
        `xslt` -
      Returns:

    - #### xslt

          public static String xslt(Source doc,
                                    Source xslt)

      Method to format/indent a XML and applying an XSLT tranformation.
      Returns:

    - #### sanitizePartId

          public static String sanitizePartId(String contentId)

Connector Packaging PERSNURSE 4.8.6 API
Copyright © {inceptionYear}-2026 eHealth. All Rights Reserved.