Class XmlUtils

java.lang.Object
org.openehealth.ipf.commons.xml.XmlUtils

public abstract class XmlUtils extends Object
Various XML utilities.
Author:
Dmytro Rud
  • Method Details

    • source

      public static Source source(String s)
      Creates an XML Source from the given XML String.
      Parameters:
      s - XML String.
      Returns:
      XML Source.
    • rootElementName

      public static String rootElementName(String s)
      Returns local name of the root element of the XML document represented by the given string, or null, when the given string does not contain valid XML.
      Parameters:
      s - XML string.
      Returns:
      root element local name, or null when it could not be determined.
    • renderJaxb

      public static String renderJaxb(javax.xml.bind.JAXBContext jaxbContext, Object object, Boolean prettyPrint)
      Creates a String representation of a JAXB object.
      Parameters:
      jaxbContext - JAXB context corresponding to the object's type
      object - The JAXB object to be processed
      prettyPrint - Whether the XML shall nbe pretty printed or not
      Returns:
      String representation of the given JAXB object
    • serialize

      public static byte[] serialize(Node inputNode) throws Exception
      Simple method to serialize a DOM-bound XML object to a byte array (string)
      Parameters:
      inputNode - DOM Node to serialize
      Returns:
      Byte array of XML in ASCII form
      Throws:
      Exception