用 ASP 解析 XML [英] Parsing XML with ASP

查看:19
本文介绍了用 ASP 解析 XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有下面的代码,我只需要帮助找出从下面的内容节点而不是纯文本获取 html 的最佳方法.非常感谢任何帮助.

I have the code below, I just need help on figuring out the best way to get html from the content node below instead of plaintext. Any help is much appreciated.

sKey = objItem.GetAttribute("id")             
Title = objItem.selectSingleNode("title").text
Blurb = objItem.selectSingleNode("blurb").text
Content = objItem.selectSingleNode("content").text
Image = objItem.selectSingleNode("image").text
myDate = objItem.selectSingleNode("date").text
myMonth = objItem.selectSingleNode("month").text

推荐答案

您可以使用 xml 属性而不是 text 属性来获取节点的 XML现在使用:

You can get the XML of a node using the xml property instead of the text property you are using now:

    dim o_xml, o_node
    set o_xml = Server.CreateObject("Msxml2.DomDocument")
    o_xml.load("books.xml")
    set o_node = o_xml.selectSingleNode("//catalog/book[@id='bk102']")
    Response.Write Server.htmlEncode(o_node.xml)

此处的文档:http://msdn.microsoft.com/en-us/library/ms755989%28v=vs.85%29.aspx

这篇关于用 ASP 解析 XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆