public class CollectorXMLUtils
extends java.lang.Object
| Constructor and Description |
|---|
CollectorXMLUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
flatListToXML(java.util.Collection<?> list,
java.lang.String objectTag,
java.lang.String surroundingTag)
Convert a list of objects (most likely strings) to an XML representation
|
static javax.xml.parsers.DocumentBuilderFactory |
getDocumentBuilder() |
static javax.xml.parsers.SAXParser |
getSaxParserObj() |
static javax.xml.transform.TransformerFactory |
getTransFacInstance() |
static javax.xml.stream.XMLInputFactory |
getXmlInputFactory() |
static java.lang.String |
mapListToGenericListXML(java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> list,
java.lang.String itemTag,
java.lang.String listTag)
Convert a list of maps into an XML representation, mapping each key-value
pair in a map to a value within a tag, with the tag name represented by
the key.
|
static java.lang.String |
mapListToGenericListXML(java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> list,
java.lang.String mapTag,
java.lang.String itemTag,
java.lang.String listTag)
Convert a list of maps into an XML representation, mapping each key-value
pair in a map to a value within a tag, with the tag name represented by
the key.
|
static java.lang.String |
mapListToXML(java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> list,
java.lang.String objectTag)
Convert a list of maps into an XML representation @see
mapListToXML(java.util.Collection<java.util.Map<java.lang.String, java.lang.Object>>, java.lang.String) |
static java.lang.String |
mapListToXML(java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> list,
java.lang.String objectTag,
java.lang.String surroundingTag)
Convert a list of maps into an XML representation, mapping each key-value
pair in a map to a value within a tag, with the tag name represented by
the key.
|
static java.lang.String |
mapToXML(java.util.Map<?,?> map)
Convert a map to an XML representation.
|
static java.lang.String |
mapToXML(java.util.Map<?,?> map,
boolean nested)
Convert a map to an XML representation.
|
static java.lang.String |
surroundWithListTag(java.lang.String tagName,
java.lang.Object value)
Surround a given string with a list tag
<tagName type = 'list'>data</tagName> |
static java.lang.String |
surroundWithTag(java.lang.String tagName,
java.lang.Object value)
Surround a given string with an "XML tag" e.g.
|
static java.lang.String |
surroundWithTag(java.lang.String tagName,
java.lang.Object value,
java.util.Map<java.lang.String,java.lang.String> attributes)
Surround a given string with an "XML tag" e.g.
|
static java.lang.String |
topologyTypeToTagName(java.lang.String topologyType)
Return the XML tag for the
Collector.GetConnections(int, String, String) surrounding tag
given a specific connection topology type, such as "Layer1" |
static java.lang.Object |
xmlToMap(java.lang.String xml)
Convert an XML string to a map representation, in the inverse way to
mapToXML(Map). |
public static java.lang.String flatListToXML(java.util.Collection<?> list,
java.lang.String objectTag,
java.lang.String surroundingTag)
list - The list to convertobjectTag - The tag to surround each object in the listsurroundingTag - The tag to surround the entire listpublic static java.lang.String mapListToGenericListXML(java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> list,
java.lang.String itemTag,
java.lang.String listTag)
<listTag type="list"><itemTag> ... map data ... </itemTag>...</listTag>list - The list to convertitemTag - The tag to surround each object in the listlistTag - The tag to surround the list itselfpublic static java.lang.String mapListToGenericListXML(java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> list,
java.lang.String mapTag,
java.lang.String itemTag,
java.lang.String listTag)
<listTag type="list"><itemTag> <mapTag>... map data ...</mapTag> </itemTag>...</listTag>list - The list to convertmapTag - The tag to surround each map objectitemTag - The tag to surround each object in the listlistTag - The tag to surround the list itselfpublic static java.lang.String mapListToXML(java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> list,
java.lang.String objectTag)
mapListToXML(java.util.Collection<java.util.Map<java.lang.String, java.lang.Object>>, java.lang.String)list - The list to convertobjectTag - The tag to surround each object in the listpublic static java.lang.String mapListToXML(java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> list,
java.lang.String objectTag,
java.lang.String surroundingTag)
list - The list to convertobjectTag - The tag to surround each object in the listsurroundingTag - A tag to surround the entire listpublic static java.lang.String mapToXML(java.util.Map<?,?> map)
map - The map to convertpublic static java.lang.String mapToXML(java.util.Map<?,?> map,
boolean nested)
<a><b>c</b></a>
= a -> b -> cmap - The map to convertpublic static java.lang.String surroundWithTag(java.lang.String tagName,
java.lang.Object value)
<tagName>value</tagName>tagName - The tag name to surroundvalue - The value to be surrounded (this will be converted to a string
using toString()public static java.lang.String surroundWithTag(java.lang.String tagName,
java.lang.Object value,
java.util.Map<java.lang.String,java.lang.String> attributes)
<tagNam attributeName="attributeValue">value</tagName>tagName - The tag name to surroundvalue - The value to be surrounded (this will be converted to a string
using toString()attributes - A map of XML attributes to set on the surrounding tagpublic static java.lang.String surroundWithListTag(java.lang.String tagName,
java.lang.Object value)
<tagName type = 'list'>data</tagName>tagName - The tag name to surround with list tagvalue - The value to be surrounded (this will be converted to a string
using toString()public static java.lang.String topologyTypeToTagName(java.lang.String topologyType)
Collector.GetConnections(int, String, String) surrounding tag
given a specific connection topology type, such as "Layer1"topologyType - The connection topology type, such as Layer1, Layer2,
Microwavepublic static java.lang.Object xmlToMap(java.lang.String xml)
mapToXML(Map). So the string @{code A( a -> A, b -> ( c -> BC ) ) xml - The xml string to convertpublic static javax.xml.transform.TransformerFactory getTransFacInstance()
public static javax.xml.parsers.DocumentBuilderFactory getDocumentBuilder()
public static javax.xml.parsers.SAXParser getSaxParserObj()
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationExceptionorg.xml.sax.SAXExceptionpublic static javax.xml.stream.XMLInputFactory getXmlInputFactory()