Linq to XML Reading an Element

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have the following XML file which I am reading using Linq to XML
<span style="color:#0000ff <span><?<span>xml version="1.0" encoding="UTF-8"
<span>?>

<div style="text-indent:-2em http://social.msdn.microsoft.com/Forums/en/# <span style="font-family:Courier New; color:#ff0000 -
<span><span style="color:#0000ff <<span style="color:#990000 <span>response<span> timestamp<span><span style="color:#0000ff =" 20101206145123 <span style="color:#0000ff <span>"<span>>


<div style="text-indent:-2em <span> <span style="font-family:Courier New; color:#ff0000
<span><span style="color:#0000ff <<span><span style="color:#990000 merchantid<span><span style="color:#0000ff ><span> test <span><span style="color:#0000ff </<span><span style="color:#990000 merchantid<span><span style="color:#0000ff >


<div style="text-indent:-2em <span> <span style="font-family:Courier New; color:#ff0000
<span><span style="color:#0000ff <<span><span style="color:#990000 account<span><span style="color:#0000ff ><span> account <span><span style="color:#0000ff </<span><span style="color:#990000 account<span><span style="color:#0000ff >


<div style="text-indent:-2em <span> <span style="font-family:Courier New; color:#ff0000
<span><span style="color:#0000ff <<span><span style="color:#990000 orderid<span><span style="color:#0000ff ><span> 1009 <span><span style="color:#0000ff </<span><span style="color:#990000 orderid<span><span style="color:#0000ff >


<div style="text-indent:-2em <span> <span style="font-family:Courier New; color:#ff0000
<span><span style="color:#0000ff <<span><span style="color:#990000 authcode
<span><span style="color:#0000ff />


<div style="text-indent:-2em <span> <span style="font-family:Courier New; color:#ff0000
<span><span style="color:#0000ff <<span><span style="color:#990000 result<span><span style="color:#0000ff ><span> 00 <span><span style="color:#0000ff </<span><span style="color:#990000 result<span><span style="color:#0000ff >


<div style="text-indent:-2em <span> <span style="font-family:Courier New; color:#ff0000
<span><span style="color:#0000ff <<span><span style="color:#990000 message<span><span style="color:#0000ff ><span> Authentication Successful <span><span style="color:#0000ff </<span><span style="color:#990000 message<span><span style="color:#0000ff >


<div style="text-indent:-2em <span> <span style="font-family:Courier New; color:#ff0000
<span><span style="color:#0000ff <<span><span style="color:#990000 pasref
<span><span style="color:#0000ff />


<div style="text-indent:-2em <span> <span style="font-family:Courier New; color:#ff0000
<span><span style="color:#0000ff <<span><span style="color:#990000 timetaken<span><span style="color:#0000ff ><span> 0 <span><span style="color:#0000ff </<span><span style="color:#990000 timetaken<span><span style="color:#0000ff >


<div style="text-indent:-2em <span> <span style="font-family:Courier New; color:#ff0000
<span><span style="color:#0000ff <<span><span style="color:#990000 authtimetaken<span><span style="color:#0000ff ><span> 0 <span><span style="color:#0000ff </<span><span style="color:#990000 authtimetaken<span><span style="color:#0000ff >


<div style="text-indent:-2em http://social.msdn.microsoft.com/Forums/en/# <span style="font-family:Courier New; color:#ff0000 -
<span><span style="color:#0000ff <<span><span style="color:#990000 threedsecure<span><span style="color:#0000ff >


<div style="text-indent:-2em <span> <span style="font-family:Courier New; color:#ff0000
<span><span style="color:#0000ff <<span><span style="color:#990000 status<span><span style="color:#0000ff ><span> N <span><span style="color:#0000ff </<span><span style="color:#990000 status<span><span style="color:#0000ff >
<div style="text-indent:-2em
<div style="text-indent:-2em I have the following code to read in the elements but using this approach I do not know how to get to the status element which is under the threedsecure element.
<div style="text-indent:-2em <span style="font-family:Verdana; font-size:x-small <span style="font-family:Verdana; font-size:x-small <span style="font-family:Verdana; font-size:x-small <span style="font-family:Verdana; font-size:x-small
<div style="background-color:white; color:black
<pre><span style="color:blue var responses = <span style="color:blue from realmpi <span style="color:blue in doc.Descendants(<span style="color:#a31515 "response")

<span style="color:blue select <span style="color:blue new

{

result = (<span style="color:blue string)realmpi.Element(<span style="color:#a31515 "result"),

message = (<span style="color:blue string)realmpi.Element(<span style="color:#a31515 "message"),

parreq = (<span style="color:blue string)realmpi.Element(<span style="color:#a31515 "pareq"),

acsurl = (<span style="color:blue string)realmpi.Element(<span style="color:#a31515 "url"),

enrolled = (<span style="color:blue string)realmpi.Element(<span style="color:#a31515 "enrolled"),

xid = (<span style="color:blue string)realmpi.Element(<span style="color:#a31515 "xid")

status = ??

[/code]

<span style="font-family:Verdana; font-size:x-small

<span style="font-family:Verdana; color:#008000; font-size:x-small <span style="font-family:Verdana; color:#008000; font-size:x-small <span style="font-family:Verdana; color:#008000; font-size:x-small








View the full article
 
Back
Top