To convert a string to an xml object on the java end, use incluenthelper. parseText (xmlReturn). getRootElement ();
In js, there are also ways to convert strings into xml objects. You can use the following functions:
Function createXml (str ){
If (document. all ){
Var xmlDom = new ActiveXObject ("Microsoft. XMLDOM ")
XmlDom. loadXML (str)
Return xmlDom
}
Else
Return new DOMParser (). parseFromString (str, "text/xml ")
} It is more convenient to read files on the js end.
Var xmlDoc = new ActiveXObject ("Msxml2.DOMDocument. 3.0 ");
XmlDoc. async = false;
XmlDoc. load ("file path"); xml operations are also very simple. If jdom or dom4j is used, the operation is quite convenient. Var domxml = createXml (Http. responseText );
Var code = domxml. getElementsByTagName ("code ");
If (code. item (0). text = "100 "){
Var parameter = domxml. getElementsByTagName ("parameter ");
Identifier = parameter. item (0). attributes. getNamedItem ("value"). value;
} The method for obtaining the node value and attribute value is different.