How to parse XML file to get specific data effectively

Posted by Carlos_Liu on Stack Overflow See other posts from Stack Overflow or by Carlos_Liu
Published on 2010-03-09T09:57:38Z Indexed on 2010/03/09 10:06 UTC
Read the original article Hit count: 341

Filed under:
|
|

I have an XML file looks like this:

<?xml version="1.0" encoding="utf-8" ?> 
 <PathMasks>
 <Mask desc="Masks_X1">
  <config id="01" mask="88" /> 
  <config id="03" mask="80" /> 
  <config id="51" mask="85" /> 
  </Mask>

 <Mask desc="Masks_X2">
  <config id="70" mask="1" /> 
  <config id="73" mask="6" /> 
  </Mask>

 <Types>
  <path id="01" desc="TC->PP1" /> 
  <path id="02" desc="TC->PP2" /> 
  <path id="03" desc="TC->PPn" /> 
  </Types>
  </PathMasks>

How to parse the file and get all the data of Mask_X1 as following:

id  value
=====
01, 88
03, 80
51, 85

© Stack Overflow or respective owner

Related posts about c#

Related posts about Xml