What are the ways to get the data from XML file using C#? -


i want data xml file using c# , need assign data dto. here need consider performance when getting data xml file. used xml deserialization data xml file taking lot of time data large xml files. please suggest me solution considering performance using c#.

if xml file huge can use xmlreader. can linq xml option.

example:

<branch>     <node>         <mynode>             <subnode code=\"0\">                 message             </subnode>         </mynode>     </node> </branch> 

using linq xml

var doc = xdocument.parse(xml); var subnode = x in doc.descendants("subnode")              select new              {                 code = x.attribute("code").value,                 msg = x.value.trim()              };  foreach (var e in subnode) {  } 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -