XmlUtils
Path
com.roma.apic.livedata.common.v1.XmlUtils
Description
This class is used to provide the XML conversion function.
Example
1 2 3 4 5 |
importClass(com.roma.apic.livedata.common.v1.XmlUtils); function execute(data) { var xml = '<a><id>2</id><name>1</name></a>' return XmlUtils.toMap(xml) } |
Method List
Returned Type |
Method and Description |
---|---|
static String |
toJson(String xml) Convert a character string in the XML format into a JSON file. |
static Map<String,Object> |
toMap(String xml) Convert XML into Map. |
static String |
toXml(Object object) Convert an object into an XML file. |
static String |
toXml(Object object, Map<String,Object> config) Convert an object into an XML file. |
Method Details
- public static String toJson(String xml)
Convert a character string in the XML format into a JSON file.
Input Parameter
xml indicates the character string in XML format.
Returns
Character string in JSON format.
Throws
org.json.JSONException
- public static Map<String,Object> toMap(String xml)
Convert XML into Map.
Input Parameter
xml indicates the character string in XML format.
Returns
Character string in MAP format.
- public static String toXml(Object object)
Convert an object into an XML file.
Input Parameter
object indicates the object to be converted.
Returns
Character string in XML format.
Throws
java.lang.Exception
- public static String toXml(Object object, Map<String,Object> config)
Convert an object into XML.
Input Parameter
- object indicates the object to be converted.
- config indicates the conversion configuration.
Returns
Character string in XML format.
Throws
java.lang.Exception
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot