com.mindtree.techworks.insight.reporting
Class SerializationXmlUtils

java.lang.Object
  extended by com.mindtree.techworks.insight.reporting.SerializationXmlUtils

public abstract class SerializationXmlUtils
extends java.lang.Object

Utility class which has methods for handling common tasks in XML serializing and deserializing Verifiers and Jobs.

Since:
Insight 1.5
Version:
$Revision: 27 $ $Date: 2007-12-16 04:58:03 -0700 (Sun, 16 Dec 2007) $
Author:
Bindul Bhowmik

Constructor Summary
SerializationXmlUtils()
           
 
Method Summary
static org.w3c.dom.Document createDocument(java.lang.String xmlString)
          Creates an XML Document from the XML String.
static java.lang.String escapeSpecialChars(java.lang.String unescapedString)
          Escapes all the special characters to avoid in the value of the string representation of the filter criterion.
static java.lang.String getSerializedObjectClassName(org.w3c.dom.Document serializedVerifier)
          Extracts the class name of the Verfier or the from the XML serialized format of it.
static java.lang.String getTextValue(org.w3c.dom.Element element)
          Returns the text value in an XML Element.
static java.lang.String serializeXmlElement(org.w3c.dom.Element element)
          Serializes the XML element passed in to string format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializationXmlUtils

public SerializationXmlUtils()
Method Detail

createDocument

public static org.w3c.dom.Document createDocument(java.lang.String xmlString)
                                           throws InitializationException
Creates an XML Document from the XML String.

Parameters:
xmlString - The Serialized XML.
Returns:
A Document for the XML passed in.
Throws:
InitializationException - If there is an exception while parsing the XML.

getTextValue

public static java.lang.String getTextValue(org.w3c.dom.Element element)
Returns the text value in an XML Element.

If an XML element is passed in in the format <element>value</element>, then the value part of it is returned.

If the element does not have a text value in it, then null is returned.

Parameters:
element - The element from which the value is to be extracted.
Returns:
The text value in the element, if present, or null.

escapeSpecialChars

public static java.lang.String escapeSpecialChars(java.lang.String unescapedString)
Escapes all the special characters to avoid in the value of the string representation of the filter criterion.

Parameters:
unescapedString - The unescaped string.
Returns:
String with the special characters escaped.

serializeXmlElement

public static java.lang.String serializeXmlElement(org.w3c.dom.Element element)
                                            throws InitializationException
Serializes the XML element passed in to string format.

Parameters:
element - The element to serialize
Returns:
The serialized XML as a string.
Throws:
InitializationException - If the underlying implementation cannot serialize the element.

getSerializedObjectClassName

public static java.lang.String getSerializedObjectClassName(org.w3c.dom.Document serializedVerifier)
                                                     throws InitializationException
Extracts the class name of the Verfier or the from the XML serialized format of it. It uses the XPath //(verifier | job)/class to look for the Class name.

Parameters:
serializedVerifier - XML Document representing the serialized Verifier.
Returns:
The class name of the Verifier or Job if present.
Throws:
InitializationException - If the class name is not present or cannot be read.


Copyright © 2003-2008 MindTree Consulting Ltd.. All Rights Reserved.