Package com.hannonhill.cascade.velocity
Class SerializerTool
- java.lang.Object
-
- com.hannonhill.cascade.velocity.SerializerTool
-
public class SerializerTool extends java.lang.Object
Contains methods used to serialize JDOM objects duringVelocityFormat
page tranformations.
-
-
Constructor Summary
Constructors Constructor Description SerializerTool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
getElementContents(java.lang.String xml, java.lang.String elementName)
Retrieves the contents of a particular element in an xml string.java.lang.String
serialize(org.jdom.Element elt, boolean removeRoot)
java.lang.String
toJson(java.lang.String xmlString, boolean removeRoot)
java.lang.String
toJson(java.util.Map<java.lang.String,java.lang.Object> map)
java.lang.String
toJson(org.jdom.Element elt, boolean removeRoot)
-
-
-
Method Detail
-
serialize
public java.lang.String serialize(org.jdom.Element elt, boolean removeRoot) throws java.lang.Exception
- Throws:
java.lang.Exception
-
toJson
public java.lang.String toJson(org.jdom.Element elt, boolean removeRoot) throws java.lang.Exception
- Throws:
java.lang.Exception
-
toJson
public java.lang.String toJson(java.lang.String xmlString, boolean removeRoot) throws java.lang.Exception
- Throws:
java.lang.Exception
-
toJson
public java.lang.String toJson(java.util.Map<java.lang.String,java.lang.Object> map)
-
getElementContents
protected java.lang.String getElementContents(java.lang.String xml, java.lang.String elementName)
Retrieves the contents of a particular element in an xml string. Makes no assumptions about the format of the string passed in. Only attempts to extract the contents of a particular element. String returned is not necesarily well-formed xml.- Parameters:
xml
-elementName
- the name of the element whose contents is going to be returned- Returns:
- Returns the contents of a particular element in an xml string. If
xml
orelementName
are empty an empty string is returned
-
-