Solved

XMLDocument and XMLnode

Posted on 2004-10-08
2
451 Views
Last Modified: 2012-06-27
I am using a server API that returns XML. Lets say I get the following XML back on a login attempt, how can i check to see if the
<CreateTicketReply url="http://www.abc.com/contoso?ticket=z46tc3gvfwvo"/> node it there.  If it is there, I want to get the value of the url.

<ConfCenter authUser="xxx" authPassword="xxxx">
  <CreateTicketRequest
    <GeneralLoginContext userID="userID"/>
    <CreateTicketReply url="http://www.abc.com/contoso?ticket=z46tc3gvfwvo"/>
  </CreateTicketRequest>
</ConfCenter>

thanks for your time!

0
Comment
Question by:jrmcdona
2 Comments
 
LVL 8

Accepted Solution

by:
Razzie_ earned 250 total points
ID: 12263918
Hi jrmcdona,

This should work:

XmlNode node = xmlDocument.SelectSingleNode("//CreateTicketReply/CreateTicketRequest/CreateTicketReply");
if(node != null)
   Console.WriteLine("The value of the url = " + node.Attributes["url"].Value);
else
   Console.WriteLine("The url node doesn't exist!");

HTH,

Razzie
0
 

Author Comment

by:jrmcdona
ID: 12266911
thanks for your help!

that got it working for me.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

932 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

21 Experts available now in Live!

Get 1:1 Help Now