【问题标题】:Classic ASP & XML经典 ASP & XML
【发布时间】:2011-02-07 01:23:01
【问题描述】:

我有下面的 XML 和下面的 ASP 语句正在工作,但我需要得到一个特定的标签而不是 response.write 一切。即我想获得“Document_Name”或“Document_Size”。

有人知道我该怎么做吗?

<PropertyImages>
     <Image>
         <Document_Name>tes1.png</Document_Name>
         <Document_Size>123</Document_Size>
     </Image>
     <Image>
          <Document_Name>Test.png</Document_Name>
          <Document_Size>123</Document_Size>
     </Image>
</PropertyImages>

这是代码..

Set objHdl = objLst.item(i)

Set PropertyImages = ObjHdl.getElementsByTagName("PropertyImages")

for x = 0 to (PropertyImages.Length-1)
    Set Image = PropertyImages.item(x)

    response.write "Image=" & Image.text & "<br>"
next

这似乎有效,但只带回第一个图像细节?我有许多图像需要返回特定属性。

Set images = objHdl.getElementsByTagName("Image")
For each image in images
     ImageURL = image.SelectSingleNode("Image_URL").text
Next

【问题讨论】:

    标签: xml asp-classic


    【解决方案1】:

    我相信你会想要这样的东西

    Set imageNodes =  objXMLDOM.documentElement.selectNodes("Image")
    For Each imageNode In imageNodes 
        documentName = imageNode.selectSingleNode("Document_Name").Text
        ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-09
      • 1970-01-01
      • 1970-01-01
      • 2010-11-03
      相关资源
      最近更新 更多