Traversing XmlDoc using Linq

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
BODY{font:x-small Verdana;margin-right:1.5em} .c{cursor:hand} .b{color:red;font-family:Courier New;font-weight:bold;text-decoration:none} .e{margin-left:1em;text-indent:-1em;margin-right:1em} .k{margin-left:1em;text-indent:-1em;margin-right:1em} .t{color:#990000}
.xt{color:#990099} .ns{color:red} .dt{color:green} .m{color:blue} .tx{font-weight:bold} .db{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;border-left:1px solid #CCCCCC;font:small Courier} .di{font:small Courier} .d{color:blue}
.pi{color:blue} .cb{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;font:small Courier;color:#888888} .ci{font:small Courier;color:#888888} PRE{margin:0px;display:inline} <script>// <![CDATA[ function f(e){ if (e.className=="ci"){if
(e.children(0).innerText.indexOf("n")>0) fix(e,"cb");} if (e.className=="di"){if (e.children(0).innerText.indexOf("n")>0) fix(e,"db");} e.id=""; } function fix(e,cl){ e.className=cl; e.style.display="block"; j=e.parentElement.children(0); j.className="c";
k=j.children(0); k.style.visibility="visible"; k.href="#"; } function ch(e){ mark=e.children(0).children(0); if (mark.innerText=="+"){ mark.innerText="-"; for (var i=1;i<e.children.length;i++) e.children(i).style.display="block"; } else if (mark.innerText=="-"){
mark.innerText="+"; for (var i=1;i<e.children.length;i++) e.children(i).style.display="none"; }} function ch2(e){ mark=e.children(0).children(0); contents=e.children(1); if (mark.innerText=="+"){ mark.innerText="-"; if (contents.className=="db"||contents.className=="cb")
contents.style.display="block"; else contents.style.display="inline"; } else if (mark.innerText=="-"){ mark.innerText="+"; contents.style.display="none"; }} function cl(){ e=window.event.srcElement; if (e.className!="c"){e=e.parentElement;if (e.className!="c"){return;}}
e=e.parentElement; if (e.className=="e") ch(e); if (e.className=="k") ch2(e); } function ex(){} function h(){window.status=" ";} document.onclick=cl; ]]></script>
<span><?<span>xml version="1.0" <span>?>

<div style="text-indent:-2em - <span><<span>a:multistatus<span> xmlns:b<span>=" urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/ <span>"<span> xmlns:d<span>=" urn:schemas:httpmail: <span>"<span>
xmlns:c<span>=" xml: <span>"<span> xmlns:a<span>=" DAV: <span>"<span>>


<div style="text-indent:-2em -- <span><<span>a:response<span>>




<div style="text-indent:-2em <span> <span><<span>a:href<span>><span>http://blr-ec-mbx01.wipro.com/Exchange/enwl.autoticketing/Inbox/No%20Subject-3.EML<span></<span>a:href<span>>


<div style="text-indent:-2em - <span><<span>a:propstat<span>>


<div style="text-indent:-2em <span> <span><<span>a:status<span>><span>HTTP/1.1 200 OK<span></<span>a:status<span>>


<div style="text-indent:-2em - <span><<span>a:prop<span>>


<div style="text-indent:-2em <span> <span><<span>d:textdescription
<span>/>


<div style="text-indent:-2em <span> <span><<span>d:datereceived<span> b:dt<span>=" dateTime.tz <span>"<span>><span>2011-11-10T07:02:03.000Z<span></<span>d:datereceived<span>>


<div style="text-indent:-2em <span> <span><<span>d:subject
<span>/>


<div style="text-indent:-2em <span> <span><<span>d:to<span>><span>"ENWL autoticketing" <enwl.autoticketing@wipro.com><span></<span>d:to<span>>


<div style="text-indent:-2em <span> <span><<span>d:from<span>><span>"Tapash Kumar Das (WT01 - TIS-Manager Support)" <tapash.das@wipro.com><span></<span>d:from<span>>

<span> <span></<span>a:prop<span>>


<span> <span></<span>a:propstat<span>>


<span> <span></<span>a:response<span>>



<div style="text-indent:-2em - <span><<span>a:response<span>>
<div style="text-indent:-2em
<div style="text-indent:-2em <span>How to use LINQ to traverse this XML.

<div style="text-indent:-2em
<div style="text-indent:-2em <span>We get this output when we query exchange server (xml document).

<div style="text-indent:-2em
<div style="text-indent:-2em <span><br/>




BODY{font:x-small Verdana;margin-right:1.5em} .c{cursor:hand} .b{color:red;font-family:Courier New;font-weight:bold;text-decoration:none} .e{margin-left:1em;text-indent:-1em;margin-right:1em} .k{margin-left:1em;text-indent:-1em;margin-right:1em} .t{color:#990000}
.xt{color:#990099} .ns{color:red} .dt{color:green} .m{color:blue} .tx{font-weight:bold} .db{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;border-left:1px solid #CCCCCC;font:small Courier} .di{font:small Courier} .d{color:blue}
.pi{color:blue} .cb{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;font:small Courier;color:#888888} .ci{font:small Courier;color:#888888} PRE{margin:0px;display:inline} <script>// <![CDATA[ function f(e){ if (e.className=="ci"){if
(e.children(0).innerText.indexOf("n")>0) fix(e,"cb");} if (e.className=="di"){if (e.children(0).innerText.indexOf("n")>0) fix(e,"db");} e.id=""; } function fix(e,cl){ e.className=cl; e.style.display="block"; j=e.parentElement.children(0); j.className="c";
k=j.children(0); k.style.visibility="visible"; k.href="#"; } function ch(e){ mark=e.children(0).children(0); if (mark.innerText=="+"){ mark.innerText="-"; for (var i=1;i<e.children.length;i++) e.children(i).style.display="block"; } else if (mark.innerText=="-"){
mark.innerText="+"; for (var i=1;i<e.children.length;i++) e.children(i).style.display="none"; }} function ch2(e){ mark=e.children(0).children(0); contents=e.children(1); if (mark.innerText=="+"){ mark.innerText="-"; if (contents.className=="db"||contents.className=="cb")
contents.style.display="block"; else contents.style.display="inline"; } else if (mark.innerText=="-"){ mark.innerText="+"; contents.style.display="none"; }} function cl(){ e=window.event.srcElement; if (e.className!="c"){e=e.parentElement;if (e.className!="c"){return;}}
e=e.parentElement; if (e.className=="e") ch(e); if (e.className=="k") ch2(e); } function ex(){} function h(){window.status=" ";} document.onclick=cl; ]]></script><hr class="sig Ramesh S B

View the full article
 
Back
Top