psdi.iface.util

Class XMLUtils

  • java.lang.Object
    • psdi.iface.util.XMLUtils


  • public class XMLUtils
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String XML_INDENT_CHAR 
    • Constructor Summary

      Constructors 
      Constructor and Description
      XMLUtils() 
    • Field Detail

    • Constructor Detail

      • XMLUtils

        public XMLUtils()
    • Method Detail

      • copyContent

        public static java.util.List copyContent(org.jdom2.Element parentElem)
        Will copy the content of an Element. Done for JDOM beta7.
        Parameters:
        parentElem -
        Returns:
      • readXMLFileToBytes

        public static byte[] readXMLFileToBytes(java.lang.String filepath)
                                         throws MXException
        Read XML file to process data.
        Parameters:
        filepath - Give path of the file.
        Returns:
        Document object
        Throws:
        MXSystemException - MAXIMO exception
        MXException
      • convertElementToBytes

        public static byte[] convertElementToBytes(org.jdom2.Element elem)
                                            throws MXException
        Throws:
        MXException
      • convertElementToString

        public static java.lang.String convertElementToString(org.jdom2.Element elem)
                                                       throws MXException
        Throws:
        MXException
      • convertBytesToElement

        public static org.jdom2.Element convertBytesToElement(byte[] byteData)
                                                       throws MXException
        Throws:
        MXException
      • convertDocumentToBytes

        public static byte[] convertDocumentToBytes(org.jdom2.Document doc)
                                             throws MXException
        Convert Document to byte array
        Parameters:
        doc - Give reference to Document.
        Returns:
        byte array
        Throws:
        MXSystemException - MAXIMO exception
        MXException
      • getResourceAsDocument

        public static org.jdom2.Document getResourceAsDocument(java.lang.String resource)
                                                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • readXMLFileToDocument

        public static org.jdom2.Document readXMLFileToDocument(java.lang.String filepath)
                                                        throws MXException
        Read XML file to process data.
        Parameters:
        filepath - Give path of the file.
        Returns:
        Document object
        Throws:
        MXSystemException - MAXIMO exception
        MXException
      • convertBytesToDocument

        public static org.jdom2.Document convertBytesToDocument(byte[] byteData)
                                                         throws MXException
        Convert Bytes to Document object
        Parameters:
        byteData - Give path of the file.
        Returns:
        Document object
        Throws:
        MXSystemException - MAXIMO exception
        MXException
      • convertXMLStringToDocument

        public static org.jdom2.Document convertXMLStringToDocument(java.lang.String xmlStr,
                                                                    java.lang.String encoding)
                                                             throws MXException
        Convert XML string to document object to process fixed data.
        Parameters:
        xmlStr - The XML in text format.
        encoding - The encoding.
        Returns:
        Document object
        Throws:
        MXApplicationException - MAXIMO exception
        MXException
      • writeDocumentToXMLFile

        @Deprecated
        public static void writeDocumentToXMLFile(org.jdom2.Document doc,
                                                              java.lang.String filepath,
                                                              java.lang.String filebackup)
                                                       throws MXException
        Deprecated. 
        Write all XML records to the file
        Parameters:
        in - Give reference to values object.
        filepath - Give path of the file.
        filebackup - Give path of the buckup file.
        top - Give name of top level.
        Throws:
        MXException - MAXIMO exception
      • writeDocumentToXMLFile

        public static void writeDocumentToXMLFile(org.jdom2.Document doc,
                                                  java.lang.String filepath)
                                           throws MXException
        Throws:
        MXException
      • writeBytesToXMLFile

        @Deprecated
        public static void writeBytesToXMLFile(byte[] in,
                                                           java.lang.String filepath,
                                                           java.lang.String top)
                                                    throws MXException
        Deprecated. 
        Write all XML records to the file
        Parameters:
        in - Give reference to values object.
        filepath - Give path of the file.
        top - Give name of top level.
        Throws:
        MXException - MAXIMO exception
      • writeBytesToXMLFile

        public static void writeBytesToXMLFile(byte[] in,
                                               java.lang.String filepath)
                                        throws MXException
        Write all XML records to the file
        Parameters:
        in - Give reference to values object.
        filepath - Give path of the file.
        Throws:
        MXException - MAXIMO exception
      • writeBytesToXMLFile

        public static void writeBytesToXMLFile(byte[] in,
                                               java.io.File filepath,
                                               boolean prettyPrint)
                                        throws MXException
        Write XML to the file
        Parameters:
        in - Give reference to values object.
        filepath - Give path of the file, includes the file name.
        prettyPrint - When set, formats the file for reading by people.
        Throws:
        MXException
      • writeBytesToXMLFile

        public static void writeBytesToXMLFile(byte[] in,
                                               java.lang.String filepath,
                                               boolean prettyPrint)
                                        throws MXException
        Write XML to the file
        Parameters:
        in - Give reference to values object.
        filepath - Give path of the file, includes the file name.
        prettyPrint - When set, formats the file for reading by people.
        Throws:
        MXException
      • prettyPrintXML

        public static java.lang.String prettyPrintXML(org.jdom2.Element element)
                                               throws MXException
        Pretty print a single element.
        Throws:
        MXException
      • readBinaryData

        public static byte[] readBinaryData(java.io.InputStream input)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • appendBytesToFile

        public static void appendBytesToFile(byte[] data,
                                             java.io.File filepath)
                                      throws MXException
        Write XML to the file
        Parameters:
        in - Give reference to values object.
        filepath - Give path of the file, includes the file name.
        prettyPrint - When set, formats the file for reading by people.
        Throws:
        MXException