xml读取问题

mzy7511 2005-06-03 01:18:49
有一段xml内容如下:
<?xml version="1.0" ?>
- <SmsStateReport>
<ErrorNumber>0</ErrorNumber>
<ErrorDescription />
- <SmsState>
- <Message>
<SrcNumber>a</SrcNumber>
<MobileNumber>a1</MobileNumber>
<State>a2</State>
<DoneTime>a3</DoneTime>
</Message>
+ <Message>
<SrcNumber>b</SrcNumber>
<MobileNumber>b1</MobileNumber>
<State>b2</State>
<DoneTime>b3</DoneTime>
</Message>
</SmsState>
</SmsStateReport>

怎样获得如下内容
a a1 a2 a3
b b1 b2 b3

最好用vbscript,别的不懂。谢谢,在线等待
...全文
129 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
mzy7511 2005-06-03
  • 打赏
  • 举报
回复
我的结构即使这样,我想要得是想知道有多少条记录,如以上的是两条记录。然后想要知道的是各条记录SrcNumber、MobileNumber、state等对应的值

谢谢,第一次接触xml
wgf001 2005-06-03
  • 打赏
  • 举报
回复
我不知道你的XML的具体结构
如果你对XML熟悉
更改上面代码的item和childnodes
使其符合你的XML结构
不然会报错的
wgf001 2005-06-03
  • 打赏
  • 举报
回复
SET xmlObj=server.CreateObject("MICROSOFT.XMLDOM")
xmlObj.load(server.MapPath("data.xml"))
set xmlLst=xmlObj.getElementsByTagName("SmsStateReport")
lins=xmlLst.length

<%for i=0 to lins-1%>
<tr align="center" bgcolor="#FFFFFF">
<td width="10%" height="25"><%=xmlLst.item(i).childNodes(0).text%></td>
<td width="5%" height="25"><%=xmlLst.item(i).Attributes(0).text%></td>
<td width="5%" height="25"><%=xmlLst.item(i).childNodes(1).text%></td>
<td width="10%" height="25"><%=xmlLst.item(i).childNodes(2).text%></td>
<td width="10%" height="25"><%=xmlLst.item(i).childNodes(3).text%></td>
<td width="10%" height="25"><%=xmlLst.item(i).childNodes(4).text%></td>
<td width="10%" height="25"><%=xmlLst.item(i).childNodes(5).childNodes(0).text%></td>
<td width="10%" height="25"><%=xmlLst.item(i).childNodes(5).childNodes(1).text%></td>
<td width="10%" height="25"><%=xmlLst.item(i).childNodes(5).childNodes(2).text%></td>
</tr>
<%next%>
goodstuday 2005-06-03
  • 打赏
  • 举报
回复
用正则,可以参考:http://community.csdn.net/Expert/topic/3999/3999204.xml?temp=.8056299

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧