com.comtrade.ecm.engine.xml

## Class XmlUtils

- java.lang.Object
- - com.comtrade.ecm.engine.xml.XmlUtils

-     public class XmlUtils
      extends java.lang.Object

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `createEscapedString(java.lang.String text)`
    `static <T> T` | `createFromFile(java.lang.String xmlPath, java.lang.Class<T> clazz)`
    `static <T> T` | `createFromFile(java.lang.String xmlPath, java.lang.Class<T> clazz, java.lang.String xsdPath)`
    `static <T> T` | `createFromStream(java.io.InputStream xmlStream, java.lang.Class<T> clazz)`
    `static <T> T` | `createFromString(java.lang.String xmlString, java.lang.Class<T> clazz)`
    `static <T> T` | `createFromString(java.lang.String xmlString, java.lang.Class<T> clazz, java.nio.charset.Charset charset)`
    `static byte[]` | `createXml(java.lang.Class<? extends java.lang.Object> clazz, java.lang.Object object)`
    `static byte[]` | `createXml(java.lang.Object object)` Converts an object into its formatted xml-representation. If object is `null`, then an empty nullobject-tag is returned.
    `static void` | `createXsd(java.lang.String xsdPath, java.lang.Class<? extends java.lang.Object> clazz)`
    `static <T> T` | `loadObject(java.io.InputStream xmlStream, java.lang.Class<T> clazz, java.lang.String xsdPath)`
    `static java.util.Date` | `toDate(javax.xml.datatype.XMLGregorianCalendar date)`
    `static javax.xml.datatype.XMLGregorianCalendar` | `toXMLGregorianCalendar(java.util.Date date)`
    `static javax.xml.datatype.XMLGregorianCalendar` | `toXMLGregorianCalendar(java.lang.String dateString, java.lang.String dateFormat)`
    `static javax.xml.datatype.XMLGregorianCalendar` | `toXMLGregorianCalendarDate(java.util.Date date)`
    `static boolean` | `validateXml(java.lang.String xsdPath, java.lang.String xmlPath)`

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

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

- - ### Method Detail

    - #### toXMLGregorianCalendar

          public static javax.xml.datatype.XMLGregorianCalendar toXMLGregorianCalendar(java.util.Date date)

    - #### toXMLGregorianCalendar

          public static javax.xml.datatype.XMLGregorianCalendar toXMLGregorianCalendar(java.lang.String dateString,
                                                                                       java.lang.String dateFormat)
                                                                                throws java.text.ParseException

      Throws:
        `java.text.ParseException`

    - #### toXMLGregorianCalendarDate

          public static javax.xml.datatype.XMLGregorianCalendar toXMLGregorianCalendarDate(java.util.Date date)

    - #### toDate

          public static java.util.Date toDate(javax.xml.datatype.XMLGregorianCalendar date)

    - #### loadObject

          public static <T> T loadObject(java.io.InputStream xmlStream,
                                         java.lang.Class<T> clazz,
                                         java.lang.String xsdPath)
                                  throws javax.xml.bind.JAXBException,
                                         org.xml.sax.SAXException

      Throws:
        `javax.xml.bind.JAXBException`
        `org.xml.sax.SAXException`

    - #### createFromFile

          public static <T> T createFromFile(java.lang.String xmlPath,
                                             java.lang.Class<T> clazz,
                                             java.lang.String xsdPath)
                                      throws javax.xml.bind.JAXBException,
                                             org.xml.sax.SAXException,
                                             java.io.IOException

      Throws:
        `javax.xml.bind.JAXBException`
        `org.xml.sax.SAXException`
        `java.io.IOException`

    - #### createFromFile

          public static <T> T createFromFile(java.lang.String xmlPath,
                                             java.lang.Class<T> clazz)
                                      throws javax.xml.bind.JAXBException,
                                             org.xml.sax.SAXException,
                                             java.io.IOException

      Throws:
        `javax.xml.bind.JAXBException`
        `org.xml.sax.SAXException`
        `java.io.IOException`

    - #### createFromStream

          public static <T> T createFromStream(java.io.InputStream xmlStream,
                                               java.lang.Class<T> clazz)
                                        throws javax.xml.bind.JAXBException,
                                               org.xml.sax.SAXException

      Throws:
        `javax.xml.bind.JAXBException`
        `org.xml.sax.SAXException`

    - #### createFromString

          public static <T> T createFromString(java.lang.String xmlString,
                                               java.lang.Class<T> clazz)
                                        throws javax.xml.bind.JAXBException,
                                               org.xml.sax.SAXException

      Throws:
        `javax.xml.bind.JAXBException`
        `org.xml.sax.SAXException`

    - #### createFromString

          public static <T> T createFromString(java.lang.String xmlString,
                                               java.lang.Class<T> clazz,
                                               java.nio.charset.Charset charset)
                                        throws javax.xml.bind.JAXBException,
                                               org.xml.sax.SAXException

      Throws:
        `javax.xml.bind.JAXBException`
        `org.xml.sax.SAXException`

    - #### createXml

          public static byte[] createXml(java.lang.Class<? extends java.lang.Object> clazz,
                                         java.lang.Object object)
                                  throws javax.xml.bind.JAXBException,
                                         java.io.IOException

      Throws:
        `javax.xml.bind.JAXBException`
        `java.io.IOException`

    - #### createXml

          public static byte[] createXml(java.lang.Object object)
                                  throws javax.xml.bind.JAXBException,
                                         java.io.IOException

      Converts an object into its formatted xml-representation.
      If object is `null`, then an empty nullobject-tag is returned.
      Parameters:
        `object` - Object that should be converted to xml-format
      Returns:
        Formatted xml-representation of an object, if object is not `null`
        Empty nullobject-tag, otherwise
      Throws:
        `javax.xml.bind.JAXBException` - if JAXBException is being thrown
        `java.io.IOException` - if IOException is being thrown

    - #### createXsd

          public static void createXsd(java.lang.String xsdPath,
                                       java.lang.Class<? extends java.lang.Object> clazz)
                                throws java.io.IOException,
                                       javax.xml.bind.JAXBException

      Throws:
        `java.io.IOException`
        `javax.xml.bind.JAXBException`

    - #### validateXml

          public static boolean validateXml(java.lang.String xsdPath,
                                            java.lang.String xmlPath)
                                     throws XsdValidationException

      Throws:
        `XsdValidationException`

    - #### createEscapedString

          public static java.lang.String createEscapedString(java.lang.String text)