Package zombie.util

Class PZXmlUtil

java.lang.Object
zombie.util.PZXmlUtil

public final class PZXmlUtil extends Object
  • Constructor Details

    • PZXmlUtil

      public PZXmlUtil()
  • Method Details

    • parseXml

      public static Element parseXml(String source) throws PZXmlParserException
      Parses the XML data from the specified Source. The Source can be either a file path, or a file GUID.
      Parameters:
      source - The data source. Can be a file path, or a file GUID.
      Returns:
      The root XML Element
      Throws:
      PZXmlParserException
    • createNewDocument

      public static Document createNewDocument()
    • forEachElement

      public static void forEachElement(Element root, Consumer<Element> consumer)
    • parse

      public static <T> T parse(Class<T> type, String source) throws PZXmlParserException
      Deserialize function. Parses the supplied XML source, and creates a new instance of the supplied type. The Source can be either a file path, or a file GUID.
      Parameters:
      type - The type of the loaded class. A new instance is created.
      source - The data source. Can be a file name or a file GUID.
      Returns:
      A new instance of the supplied type, loaded with the supplied data source.
      Throws:
      PZXmlParserException
    • write

      public static <T> void write(T data, File outFile) throws TransformerException, IOException, javax.xml.bind.JAXBException
      Throws:
      TransformerException
      IOException
      javax.xml.bind.JAXBException
    • write

      public static void write(Document doc, File outFile) throws TransformerException, IOException
      Throws:
      TransformerException
      IOException
    • tryWrite

      public static <T> boolean tryWrite(T data, File outFile)
    • tryWrite

      public static boolean tryWrite(Document doc, File outFile)