How to retrive the text value from the xml tag enclosure url?

I have some problems with print the XML enclosure tag, this is my code, please provide a complete sample....

Set Nodes = objXML.selectNodes("//item")
For Each Node In Nodes
Response.Write Node.selectSingleNode("title").Text
Response.write Node.selectSingleNode("enclosure").Text


next

XML sample

-------------XML---------------------------------------
<item>
<title>My little title</title>
<link>http://www.whatever.com</link>
<description>my little description</description>
<enclosure url="http://www.whatever.com/images/56308tiny.jpg" length="3000" type="image/jpg" />
</item>




Answer this question

How to retrive the text value from the xml tag enclosure url?

  • narend

    Hi dingdong,

    Text in XML refers to the text node of a parent element i.e. <element>text<element>, since your enclosure element is an empty element it has no text node, all it's information is stored in attributes. Atributes are treated quite unique.

    I'll presume your wanting to display the url attribute...

    try this instead, I have not ran this and I'm working from memory..

    Node.selectSingleNode("enclosure").getAttribute("url")



  • How to retrive the text value from the xml tag enclosure url?