Delivery law traverses the properties and node values of the XML tree
Note: Function XML2Javascript (XML_NAME, DATA) // Parameter XML_Name: XML Document File Name, DATA: The array object name of the storage data is successfully called, basically in accordance with the DOM's call method, but will "convert to ' [] '
/ ** * Recursive method Read XML all data (including attribute values) put in array * * member >> * * * Return >> * * * Created by: Creation time: * * Editor: WYC Write time: 02-12 -7 * * Modifier: Modification time: new features: * * / function XML2Javascript (XML_Name, DATA) {// -------------------- ------------------------------ / / | Establish msxml.domdocument | var XML_DOC = New ActiveXObject ("msxml.domdocument" ); Xml_doc.async = false; XML_Doc.Load (XML_Name); // ------------------------------ -------------------- = xml_doc.documentelement; var data_obj = data; eval (data_obj "= new object ();"); _GETXML (Obj , Data_Obj)}
/ ** * internal function * * member >> * * * Return >> * * * Created: Creation time: * * Editor: WYC Write time: 02-12-7 * * Modifier: Modification time: new increase Function: * * / function _getxml (obj, data_obj) {var node_count = obj.childNodes.Length; if (node_count == 0) {// If there is no child node, then return return;} Eval (Data_Obj ".childNodes = New array (); "); evAl (Data_Obj " ._childNodes = new array (); "); for (var i = 0; i // Property VAR attribute_count = obj.childnodes (i) .attributes.length; eval (data_obj ".childnodes [i] .attributes = new array ();"); // Attribute array EVAL (Data_Obj ".childnodes [ I] ._ attributes = new array (); "); // Property Cache array for (var j = 0; j Script>