Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

XMLDocument and XMLnode

Posted on 2004-10-08
2
Medium Priority
?
458 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 750 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

927 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