<?xml version="1.0" encoding="gb2312"?>
<kialison><News id = "p1">
<TITLE>网易</TITLE>
<link>http://www.163.com</link>
</News><News id = "p2">
<TITLE>百度</TITLE>
<link>http://www.163.com</link>
</News>
</kialison> <html>
<head><script for="window" event="onload">
xmldso.XMLDocument.load("1.xml");
</script><TITLE>News</TITLE>
</head><body><object WIDTH="0" HEIGHT="0" CLASSID="clsid:550dda30-0541-11d2-9ca9-0060b0ec3d39" ID="xmldso"> </object><table>
<tr>
<td>新闻标题:</td>
<td><a href="span id="p1" datasrc=#xmldso datafld="link"">  <SPAN  DATASRC=#xmldso DATAFLD="TITLE"></SPAN></a>
</td>
</tr>
</table>
</body>
</html>
我要读出XML 全部数据  请问我应该怎么写?

解决方案 »

  1.   

    正确读出来应该是Html显示应该是网易 带连接
    百度 带连接
      

  2.   

    // 取得Url中的参数
    function strUrlPara(Para) 
    {
     var _url = location.href + "&"; 
     var regex = new RegExp("(\\?|\\&)" + Para + "=([^\\&\\?]*)\\&", "gi");
     if (!regex.test(_url)) 
     {
      return "";
     }
     var arr = regex.exec(_url);
     return (RegExp.$2);
    }
    function ParseXML()
    {
     mmstype = strUrlPara("mmstype");
     mmsid = strUrlPara("mmsid");
     var xml=new ActiveXObject("Microsoft.XMLDOM");
     xml.async="false"; 
    //var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
    //xmlHttp.open("GET","http://wx.caishow.com/xml/"+mmstype+"/"+mmsid+".xml",false); 
    //xmlHttp.send();
    //xmlHttp.load(xmlHttp.responseXML);
    //return xmlHttp.responseXML;        if (mmsid=="" || mmsid==null)
            {
       mmstype="1";
       mmsid="32784";
            }
      xml.load("/xml/"+mmstype+"/"+mmsid+".xml");
      //if(xml.parseError!=0)   
      //{
      // window.location="http://www.www.com/Tnsend/XmlCreate.aspx?mmsid="+id;
      // return;
      //}
      var root=xml.documentElement;
      
      stitle = root.childNodes(0).childNodes(1).text;  
      stype = root.childNodes(0).childNodes(2).text;
      suid = root.childNodes(0).childNodes(3).text;
      surl = root.childNodes(0).childNodes(4).text;  document.all.mmstitle.innerHTML=stitle;
      document.all.mmstitle2.innerHTML="下载《"+stitle+"》";     
      document.title=stitle;  if(stype=="1" || stype=="2" || stype=="4" || stype =="5")
      {
       resaddress = "http://res.caishow.com/caix/"+suid+surl; 
       var play="<div style='WIDTH: 0px;HEIGHT: 0px'><embed src='"+resaddress+"' autostart='true' loop='true' hidden='true' width='0' height='0'></div>"
       document.write(play);
      } 
      if(stype=="3" || stype=="6")
      {
       imgSrc = "http://res.caishow.com/caix/"+suid+surl; 
       document.getElementById("pt").src = imgSrc;
      }

    ParseXML();
    function CheckMobile(m)
    {
     if( ((m.length!=11) || isNaN(m) || (m.indexOf("13")!=0&&m.indexOf("159")!=0&&m.indexOf("153")!=0))  && ( (m.length!=12 && m.length!=11) || m.indexOf("0")!=0 ))
     {
      return false;
     }
     else
     {
      return true;
     }
    }
    window.onload=function()
    {
     var c=document.getElementById("strmb");
     c.focus();
     document.getElementById("send").onclick= function()
     { 
      if(!CheckMobile(c.value))
      {
       alert("请输入一个正确的手机号码。");
       c.select();
      }
      else
      {
       var strarg= (location.toString().indexOf("?")>0)?location.toString().split("?")[1]:"";
       document.getElementById("sendok").src= "http://wx.caishow.com/unsend/SendPre.asp?mobile="+c.value+"&"+strarg; 
       document.getElementById("sendks").style.display="none";
       document.getElementById("sendok").style.display="block"
       document.getElementById("Msg").style.fontSize=11;
      }
     }
    }
      

  3.   


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>发送</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <link rel="stylesheet" type="text/css" href="images/sender.css">
    </head>
    <body bgcolor="#ffffff">
    <table width="536" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
     <tr>
      <td width="536" height="67" background="images/sender_r1_c1.gif" bgcolor="#FFFFFF">&nbsp;</td>
     </tr>
     <tr>
      <td>
         <table align="left" border="0" cellpadding="0" cellspacing="0" width="536">
        <tr>
         <td width="170" height="280" align="center" valign="top" bgcolor="#FFFFFF">
            <table width="150" border="0" cellspacing="2" cellpadding="4">
              <tr>
               <td align="center" bgcolor="#FF0099" class="title">下载步骤</td>
              </tr>
              <tr>
               <td height="150" align="left" bgcolor="#eeeeee"><p>1.页面填入手机号,点击“下一步”</p><p>2.请根据页面提示回复信息</p>
              <p>3. 下载成功!</p></td>
              </tr>
            </table>
           <table width="150" border="0" cellspacing="0" cellpadding="0">
             <tr>
              <td height="80" align="left" valign="middle">本服务只适应于使用彩信手机且开通GPRS服务的中国移动全球通、动感地带、神州行用户</td>
             </tr>
          </table>
          </td>
         <td>
           <table align="left" border="0" cellpadding="0" cellspacing="0" width="172">
           <tr>
            <td>
              <table align="left" border="0" cellpadding="0" cellspacing="0" width="172">
              <tr>
               <td width="23" height="190" background="images/sender_r2_c2.gif">&nbsp;</td>
               <td>
                  <table align="left" border="0" cellpadding="0" cellspacing="0" width="128">
                  <tr>
                  <td width="128" height="128" bgcolor="#FFFFFF"><IMG id=pt height=128 src="images/7.gif" width=128></td>
                 </tr>
                 <tr>
                  <td><img name="sender_r3_c3" src="images/sender_r3_c3.gif" width="128" height="22" border="0" id="sender_r3_c3" alt=""></td>
                 </tr>
                 <tr>
                  <td width="128" height="40" valign="top" background="images/sender_r4_c3.gif" align="center"><DIV id=mmstitle></DIV></td>
                 </tr>
                </table>
               </td>
               <td width="21" height="190" background="images/sender_r2_c4.gif">&nbsp;</td>
              </tr>
             </table>
            </td>
           </tr>
           <tr>
            <td width="172" height="90" background="images/sender_r5_c2.gif">&nbsp;</td>
           </tr>
          </table>
         </td>
         <td width="194" height="280" align="center" valign="top" bgcolor="#FFFFFF">
            <table width="96%" border="0" cellspacing="0" cellpadding="4" id=sendks>
            <tr>
             <td align="left"><DIV id=mmstitle2></DIV>
              您的手机号码:</td>
            </tr>
            <tr>
             <td align="left"><input type="text" name="strmb" id=strmb maxLength=12></td>
            </tr>
            <tr>
             <td align="left"><INPUT id=send type=image src="images/next.gif" value=下一步></td>
            </tr>
           </table><IFRAME id=sendok style="DISPLAY: none" src="about:blank" frameBorder=0 scrolling=no width=120px height=120px></IFRAME>      
        </td>
       </tr>
      </table>
     </td>
    </tr>
    <tr>
     <td><img name="sender_r6_c1" src="images/sender_r6_c1.gif" width="536" height="18" border="0" id="sender_r6_c1" alt=""></td>
     </tr>
    </table>
    <script type="text/javascript" src="mms.js"></script></body>
    </html>
      

  4.   

    <!--#include virtual="Function/function.asp"-->
    <%
     Dim Conn, sql, Mobile, Stat, strError, Rs
     Dim id, stitle, stype, suid, surl, c, mmstype, mmsid
     Dim xml, res_title, res_type, res_uid, path, item, i mmstype = Request("mmstype")
     mmsid = Request("mmsid") Set xml=Server.CreateObject("Microsoft.XMLDOM")
     xml.Async=False
     xml.ValidateOnParse=False
     xml.Load(server.mappath("/xml/"+mmstype+"/"+mmsid+".xml")) stype = 0
     
     Set item=xml.getElementsByTagName("Table")
     For i=0 To (item.Length-1)
      Set res_title=item.Item(i).getElementsByTagName("res_title")
      Set res_type=item.Item(i).getElementsByTagName("res_type")
      Set res_uid=item.Item(i).getElementsByTagName("res_uid")
      Set path=item.Item(i).getElementsByTagName("path")
      stitle = res_title.Item(0).Text
      stype = res_type.Item(0).Text
      suid = res_uid.Item(0).Text
      surl = path.Item(0).Text
     Next
     ' Response.end
     Mobile = Request("mobile")
    ' stitle = Request("t")
    ' stype = Request("p")
    ' suid = Request("u")
    ' surl = Request("f")
     If Request("c") = "" Then 
      c = 0
     Else
      c = int(Request("c"))
     End If '文件地址---------------------------
     'Select Case stype
     ' Case "1" or "2"
     '  surl = "http://res.caishow.com/caix/"+suid+"/ring/"+surl
     ' Case "3"
     '  surl = "http://res.caishow.com/caix/"+suid+"/pic/"+surl 
     ' Case "6"
     '  surl = "http://res.caishow.com/caix/"+suid+"/video/"+surl
     'End Select
     surl = "www.caishow.com/send6000.asp?res=http://res.caishow.com/caix/"+suid+surl
     '-----------------------------------
     
     If Not IsObject(Conn) Then ConnectionDatabase sql = "Select channel from t_channel where id = (Select top 1 cp_channel From T_CP_Info where cp_id = "&c&")"
     Set Rs = Conn.QueryDataBySql(sql,strError)
     
     If Not IsObject(Conn) Then ConnectionDatabase
     If not Rs.eof Then
      Select Case Rs(0)
       Case "8002"
        'c 值为8002通道
        sql = "exec sp8002_Send_Proc '"&Mobile&"','"&stitle&"','"&stitle&"','"&surl&"',"&c&","&stype&""
        Set Rs = Conn.QueryDataBySql(sql,strError)
       Case "6000"
        'c 值为6000通道
        sql = "exec sp6000_Send_Proc_2 '"&Mobile&"','"&stitle&"','"&stitle&"','"&surl&"',"&c&","&stype&""
        Set Rs = Conn.QueryDataBySql(sql,strError)
      End Select
      Response.write "<span style='font-size=14px'>发送成功!请等待接收.......</span>"
      'response.write sql
     Else
      Response.write "<span style='font-size=14px'>合作伙伴错误......</span>"
     End If
     
     Public Sub ConnectionDatabase
      Set Conn = server.createobject("DBAccess.CAccess")
     End Sub
    %>
      

  5.   

    ----------------employees.xml-----------------------------<?xml version="1.0" encoding="gb2312"?>
    <employees>
    <employee name="J.Doe">
    <job>Programmer</job>
    <salary>32768</salary>
    </employee>
    <employee name="A.Baker">
    <job>Sales</job>
    <salary>70000</salary>
    </employee>
    <employee name="Big Cheese">
    <job>CEO</job>
    <salary>100000</salary>
    </employee>
    </employees>----------------------test.html------------------------<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    <script language="javascript">
    function loadXML(handler) {
    var url = "employees.xml";
    if(document.implementation&&document.implementation.createDocument) {
    var xmldoc = document.implementation.createDocument("", "", null);
    xmldoc.onload = handler(xmldoc, url);
    xmldoc.load(url);
    }
    else if(window.ActiveXObject) {
    var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
    xmldoc.onreadystatechange = function() {
    if(xmldoc.readyState == 4) handler(xmldoc, url);
    }
    xmldoc.load(url);
    }
    }
    function makeTable(xmldoc, url) {
    var table = document.createElement("table");
    table.setAttribute("border","1");
    table.setAttribute("width","600");
    table.setAttribute("class","tab-content");
    document.body.appendChild(table);
    var caption = "Employee Data from " + url;
    table.createCaption().appendChild(document.createTextNode(caption));
    var header = table.createTHead();
    var headerrow = header.insertRow(0);
    headerrow.insertCell(0).appendChild(document.createTextNode("姓名"));
    headerrow.insertCell(1).appendChild(document.createTextNode("职业"));
    headerrow.insertCell(2).appendChild(document.createTextNode("工资"));
    var employees = xmldoc.getElementsByTagName("employee");
    for(var i=0;i<employees.length;i++) {
    var e = employees[i];
    var name = e.getAttribute("name");
    var job = e.getElementsByTagName("job")[0].firstChild.data;
    var salary = e.getElementsByTagName("salary")[0].firstChild.data;
    var row = table.insertRow(i+1);
    row.insertCell(0).appendChild(document.createTextNode(name));
    row.insertCell(1).appendChild(document.createTextNode(job));
    row.insertCell(2).appendChild(document.createTextNode(salary));
    }
    }
    </script>
    </head><body onLoad="loadXML(makeTable)">
    </body>
    </html>
      

  6.   

    <table datasrc=#xmldso>
    <thead>
    <tr>
    <td>新闻标题:</td>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td><a href="span id="p1"  datafld="link"">  <SPAN  DATAFLD="TITLE"></SPAN></a>
    </td>
    </tr>
    <tbody>
    </table>
      

  7.   

    看看这个例子哦,呵呵:
    http://www.bbs180.com/topictag-34.aspx