Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

XML/ASP/VBS Identifying a Value of a Child node

Posted on 2009-04-14
2
Medium Priority
?
408 Views
Last Modified: 2012-05-06
Hi Guys,

Can someone please help me understand the following:

I get a SOAP request back from a 3rd party and I need to get the following info:

EmailAddress, Name, and the [SubscriberCustomField] MemberNo.  I can get the first two with the attached code however I don't know the syntax to search through the node "SubscriberCustomField" and find the <value> where the <key> = "MemberNo".

Can someone point me in the right direction please?

Cheers!
JetGrrrL


Set objSubs = XmlDoc.selectNodes("//Subscriber")
For Each objSubInfo In objSubs
   Set colInfo = objSubInfo.childNodes
   Response.write "Email:", colInfo.Item(0).Text
   Response.write "Name:", colInfo.Item(1).Text
Next
 
 
<Subscribers.GetBouncedResponse xmlns="http://sadsdsddsfsdf">
	<Subscribers.GetBouncedResult>
	<Subscriber>
		<EmailAddress>random@here.com</EmailAddress>
		<Name>Random</Name>
		<Date>21-12-2009</Date>
		<State>NSW</State>
		<SubscriberCustomField>
			<Key>MemberNo</Key>
			<Value>123456</Value>
			<Key>MemberType</Key>
			<Value>Green</Value>
		</SubscriberCustomField>
	</Subscriber>
	<Subscriber>
		<EmailAddress>random@here.com.au</EmailAddress>
		<Name>Random3</Name>
		<Date>21-11-2009</Date>
		<State>NSW</State>
		<SubscriberCustomField>
			<Key>MemberNo</Key>
			<Value></Value>
			<Key>MemberType</Key>
			<Value></Value>
		</SubscriberCustomField>
	</Subscriber>
	</Subscribers.GetBouncedResult>
</Subscribers.GetBouncedResponse>

Open in new window

0
Comment
Question by:jetgrrrl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 28

Accepted Solution

by:
sybe earned 2000 total points
ID: 24145002
Basically it works the same all the way. Each node can have childnodes, and you can use the same way of coding to loop through it.


Set oSubscriberNodes =  = XmlDoc.selectNodes("//Subscriber")
For each oSingleSubscriberNode in oSubscriberNodes
    Response.write "Email: " & oSingleSubscriberNode.selectSingleNode("EmailAddress").Text & "<br>"
    Response.write "Name: " & oSingleSubscriberNode.selectSingleNode("Name").Text & "<br>"
    Response.write "Date: " & oSingleSubscriberNode.selectSingleNode("Date").Text & "<br>"
    For each oCustomFieldNode In oSingleSubscriberNode.selectSingleNode("SubscriberCustomField")
        Response.write "Customfield, Name = " oCustomFieldNode.Name & ", Value: " & oCustomFieldNode.Name & "<br>"
    Next
Next

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question