解析XML与ASP [英] Parsing XML with ASP
本文介绍了解析XML与ASP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下code,我只是需要搞清楚,将会在下面,而不是明文从内容节点HTML的最佳方式帮助。任何帮助深表AP preciated。
SKEY = objItem.GetAttribute(ID)
标题= objItem.selectSingleNode(题)。文本
导语= objItem.selectSingleNode(的Blurb)。文本
内容= objItem.selectSingleNode(内容)。文本
图像= objItem.selectSingleNode(图像)。文本
数值指明MyDate = objItem.selectSingleNode(DATE)。文本
myMonth = objItem.selectSingleNode(月)。文本
解决方案
您可以使用 XML
属性而不是文本
你现在正在使用属性:
暗淡o_xml,o_node
设置o_xml =的Server.CreateObject(Msxml2.DomDocument)
o_xml.load(把books.xml)
设置o_node = o_xml.selectSingleNode(//目录/书[@ ID ='bk102'])
回复于Server.htmlEn code(o_node.xml)
在这里的文档:的http:// MSDN .microsoft.com / EN-US /库/ ms755989%28V = vs.85%29.aspx
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
解决方案
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)
Docs here: http://msdn.microsoft.com/en-us/library/ms755989%28v=vs.85%29.aspx
这篇关于解析XML与ASP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文