Class XmlUtils

java.lang.Object
dev.voidframework.core.utils.XmlUtils

public final class XmlUtils extends Object
Utility to handle XML document.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> T
    fromXml(byte[] xmlByteArray, com.fasterxml.jackson.databind.JavaType outputJavaType)
    Converts a XML document into to a Java object.
    static <T> T
    fromXml(byte[] xmlByteArray, Class<T> outputClassType)
    Converts a XML document into to a Java object.
    static <T> T
    fromXml(InputStream inputStreamXml, com.fasterxml.jackson.databind.JavaType outputJavaType)
    Converts a XML document into to a Java object.
    static <T> T
    fromXml(InputStream inputStreamXml, Class<T> outputClassType)
    Converts a XML document into to a Java object.
    static <T> T
    fromXml(Document xml, com.fasterxml.jackson.databind.JavaType outputJavaType)
    Converts a XML document into to a Java object.
    static <T> T
    fromXml(Document xml, Class<T> outputClassType)
    Converts a XML document into to a Java object.
    static String
    Converts an object to XML document.
    static String
    Converts an XML to string.
    static Document
    toXml(byte[] data)
    Converts a byte array to an XML document.
    static Document
    toXml(InputStream inputStreamXml)
    Converts a InputStream to an XML document.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • toString

      public static String toString(Document xml)
      Converts an XML to string.
      Parameters:
      xml - The XML to convert.
      Returns:
      The string representation.
    • toString

      public static String toString(Object obj)
      Converts an object to XML document.
      Parameters:
      obj - Object to convert in YAML
      Returns:
      The string representation
    • fromXml

      public static <T> T fromXml(Document xml, Class<T> outputClassType)
      Converts a XML document into to a Java object.
      Type Parameters:
      T - The type of the Java object
      Parameters:
      xml - XML document to convert
      outputClassType - Expected Java object type
      Returns:
      The Java object
    • fromXml

      public static <T> T fromXml(Document xml, com.fasterxml.jackson.databind.JavaType outputJavaType)
      Converts a XML document into to a Java object.
      Type Parameters:
      T - The type of the Java object
      Parameters:
      xml - XML document to convert
      outputJavaType - Expected Java object type
      Returns:
      The Java object
    • fromXml

      public static <T> T fromXml(byte[] xmlByteArray, Class<T> outputClassType)
      Converts a XML document into to a Java object.
      Type Parameters:
      T - The type of the Java object
      Parameters:
      xmlByteArray - XML document as bytes array to convert
      outputClassType - Expected Java object type
      Returns:
      The Java object
    • fromXml

      public static <T> T fromXml(InputStream inputStreamXml, Class<T> outputClassType)
      Converts a XML document into to a Java object.
      Type Parameters:
      T - The type of the Java object
      Parameters:
      inputStreamXml - InputStream containing a XML document to convert
      outputClassType - Expected Java object type
      Returns:
      The Java object
    • fromXml

      public static <T> T fromXml(byte[] xmlByteArray, com.fasterxml.jackson.databind.JavaType outputJavaType)
      Converts a XML document into to a Java object.
      Type Parameters:
      T - The type of the Java object
      Parameters:
      xmlByteArray - XML document as bytes array to convert
      outputJavaType - Expected Java object type
      Returns:
      The Java object
    • fromXml

      public static <T> T fromXml(InputStream inputStreamXml, com.fasterxml.jackson.databind.JavaType outputJavaType)
      Converts a XML document into to a Java object.
      Type Parameters:
      T - The type of the Java object
      Parameters:
      inputStreamXml - InputStream containing a XML document to convert
      outputJavaType - Expected Java object type
      Returns:
      The Java object
    • toXml

      public static Document toXml(byte[] data)
      Converts a byte array to an XML document.
      Parameters:
      data - data to convert in XML
      Returns:
      The XML document
    • toXml

      public static Document toXml(InputStream inputStreamXml)
      Converts a InputStream to an XML document.
      Parameters:
      inputStreamXml - InputStream containing data to convert in XML
      Returns:
      The XML document