com.flexive.shared
Class FxXMLUtils

java.lang.Object
  extended by com.flexive.shared.FxXMLUtils

public class FxXMLUtils
extends java.lang.Object

XML Utilities

Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)

Constructor Summary
FxXMLUtils()
           
 
Method Summary
static java.lang.String fromCData(java.lang.String cdata)
          Convert a CData back to a String
static java.lang.String getElementData(java.lang.String xml, java.lang.String element)
          Get the character content of an element in xml data
static java.lang.String toCData(java.lang.String content)
          Convert a content to CDATA and preserve all existing CDATA
static java.lang.String toXML(com.thoughtworks.xstream.XStream xStream, java.lang.Object object)
          Convenience method to create a more compact XML representation of an object than XStream.toXML(Object) creates (no pretty-printing).
static void writeSimpleTag(javax.xml.stream.XMLStreamWriter writer, java.lang.String tag, java.lang.Object value, boolean asCData)
          Write a "simple" tag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FxXMLUtils

public FxXMLUtils()
Method Detail

getElementData

public static java.lang.String getElementData(java.lang.String xml,
                                              java.lang.String element)
Get the character content of an element in xml data

Parameters:
xml - the complete xml data
element - requested element
Returns:
data

toCData

public static java.lang.String toCData(java.lang.String content)
Convert a content to CDATA and preserve all existing CDATA

Parameters:
content - content to convert
Returns:
character data encoded content

fromCData

public static java.lang.String fromCData(java.lang.String cdata)
Convert a CData back to a String

Parameters:
cdata - CData to convert
Returns:
String

toXML

public static java.lang.String toXML(com.thoughtworks.xstream.XStream xStream,
                                     java.lang.Object object)
Convenience method to create a more compact XML representation of an object than XStream.toXML(Object) creates (no pretty-printing).

Parameters:
xStream - the xstream instance
object - the object to be marshalled
Returns:
the XML representation of the object

writeSimpleTag

public static void writeSimpleTag(javax.xml.stream.XMLStreamWriter writer,
                                  java.lang.String tag,
                                  java.lang.Object value,
                                  boolean asCData)
                           throws javax.xml.stream.XMLStreamException
Write a "simple" tag

Parameters:
writer - xml writer
tag - tag name
value - value
asCData - use CDData?
Throws:
javax.xml.stream.XMLStreamException - on errors