js 解析 xml 属性
function init() {
var viewChartID = 0;
var viewChartSum = "" ;
reportName = document.getElementById("reportName").value;
xmlDoc=loadXMLDoc("./charreport/xml/viewChart.xml");
x=xmlDoc.getElementsByTagName('viewChart')[0].childNodes;
for (i=0;i<x.length;i++)
{
//取得xml中的group 的属性 name
var n=x[i].getAttribute('name');
if(reportName==n) {
var m = x[i].childNodes;
for(var y=0;y<m.length;y++) {
viewChartName = m[y].childNodes[0].nodeValue;
viewChartSum = viewChartSum+"<div id='"+i+"'><a href=javascript:gochart('"+viewChartName+"')>"+viewChartName+"</a></div>";
document.getElementById("viewChart1").innerHTML = viewChartSum;
document.getElementById("viewChart2").innerHTML = viewChartSum;
}
}
}
}
function loadXMLDoc(dname)
{
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc=document.implementation.createDocument("","",null);
}
catch(e) {alert(e.message)}
}
try
{
xmlDoc.async=false;
xmlDoc.load(dname);
return(xmlDoc);
}
catch(e) {alert(e.message)}
return(null);
}
<?xml version="1.0" encoding="utf-8"?>
<viewChart>
<group name = "Outage_Details" >
<chart_name>test3</chart_name>
<chart_name>test4</chart_name>
</group>
<group name = "FOPS_Ranking_Analysis" >
<chart_name>test1</chart_name>
<chart_name>test2</chart_name>
</gr
相关文档:
//create a new Document
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document d = db.newDocument();
//add root Node
Element noteuser = d.createElement("note-users");
d.appendChil ......
原文链接:http://www.cnblogs.com/ding0910/archive/2007/07/12/815407.html
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using BX.Interface;
......
XPath 语法
2007-06-05 17:24
XPath 语法
作者:w3pop.com 翻译/整理:w3pop.com 发布:2007-04-29 浏览:674 :: ::
XPath Nodes(节点) XPath Axes
XPath uses path expressions to select nodes or node-sets in an XML document. The node is selected by following a path or steps.
XPath 通过路径表达式从XM ......
1:如何通过socket代理来访问服务端:
String proxyHost =
"192.168.204.212"
;
String proxyPort =
"1080"
;
//通知Java要通过代理进行连接。
正在装载数据……
System.get ......