js操作XML文件的例子
var xmlDoc = new ActiveXObject( " Microsoft.XMLDOM " ); xmlDoc.async = false ; xmlDoc.load( " Tipsxml/tips.xml " ); var firstinfo = xmlDoc.documentElement.selectSingleNode( " Class[@name='文章管理'] " ).childNodes; for ( var j = 0 ;j < firstinfo.length;j ++ ) { var newOption = window.document.createElement( " OPTION " ); if (firstinfo[j].getAttribute( " name " ) != "" ) newOption.text = firstinfo[j].getAttribute( " name " ); else newOption.text = " 全部子类 " ; newOption.value = firstinfo[j].getAttribute( " code " ); drp2.options.add(newOption); }
转载于:https://www.cnblogs.com/tuyile006/archive/2007/09/17/895524.html
相关资源:Javascript读取xml文件