Package org.openehealth.ipf.commons.xml
Class XmlUtils
java.lang.Object
org.openehealth.ipf.commons.xml.XmlUtils
Various XML utilities.
- Author:
- Dmytro Rud
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
renderJaxb
(javax.xml.bind.JAXBContext jaxbContext, Object object, Boolean prettyPrint) Creates a String representation of a JAXB object.static String
Returns local name of the root element of the XML document represented by the given string, ornull
, when the given string does not contain valid XML.static byte[]
Simple method to serialize a DOM-bound XML object to a byte array (string)static Source
Creates an XML Source from the given XML String.
-
Method Details
-
source
Creates an XML Source from the given XML String.- Parameters:
s
- XML String.- Returns:
- XML Source.
-
rootElementName
Returns local name of the root element of the XML document represented by the given string, ornull
, 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 typeobject
- The JAXB object to be processedprettyPrint
- Whether the XML shall nbe pretty printed or not- Returns:
- String representation of the given JAXB object
-
serialize
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
-