Wrox Programmer Forums
|
Classic ASP XML Using ASP 3 and XML. See also the XML category for more XML discussions not relating to ASP. NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 12th, 2005, 01:09 PM
Authorized User
 
Join Date: Jan 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML Namespace and ASP SelectNodes

Hey All'
i have the following ebay api response thats saved as an xml file
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<GeteBayOfficialTimeResponse  xmlns="urn:ebay:apis:eBLBaseComponents">
    <Timestamp>2005-08-12T02:33:09.184Z</Timestamp>
    <Ack>Success</Ack>
    <CorrelationID>00000000-00000000-00000000-00000000-00000000-00000000-0000000000</CorrelationID>
    <Version>421</Version>
    <Build>e421_core_Bundled_1630320_R1</Build>
</GeteBayOfficialTimeResponse>
And im using the following asp code to load the doc and display the info from the Timestamp.

Code:
<%
xmlNamespace = "urn:ebay:apis:eBLBaseComponents:"
Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async = false
xmlDoc.load("1.xml")
xmlDoc.setProperty"SelectionNamespaces","xmlns:b='urn:ebay:apis:eBLBaseComponents'"
set y = xmlDoc.selectNodes("//b:Timestamp/text()")

For each x in y
Response.Write(y)
Next
%>
I receive no error but i believe my issue is in the bolded above can anyone tell me the proper way to do this?


 
Old August 13th, 2005, 04:41 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

That should work, with the extra part below, although a more efficient search, avoiding the costly "//" is:
Code:
set y = xmlDoc.selectNodes("/*/b:Timestamp/text()")
You need to show the nodeValue or the data property of the returned nodes.
Code:
Response.write x.nodeValue 'or x.data as it's a text node

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Transforming XML From One Namespace to Another mail4kaja XSLT 1 November 10th, 2008 10:14 AM
convert XML to XMl - Another Namespace question bonekrusher XSLT 2 July 10th, 2007 07:32 AM
C# XML--SelectSingleNode/SelectNodes is failing. gijomk C# 1 August 29th, 2006 09:48 AM
C# XML--SelectSingleNode/SelectNodes is failing. gijomk XML 2 August 28th, 2006 03:28 AM
xml namespace and asp werD420 XML 1 August 12th, 2005 01:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.