Solved

XMLDocument and XMLnode

Posted on 2004-10-08
2
454 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
[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 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

726 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