Solved

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

Posted on 2009-04-14
2
397 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
2 Comments
 
LVL 28

Accepted Solution

by:
sybe earned 500 total points
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now