Click here to Skip to main content
15,908,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
Can any body tell how access the nodes of xml document in intellisence of vs2008 like properties

Example:
XML
<LstDelByRLDTResponseItem>
   <ADID/>
   <ADRT>1</ADRT>
   <ALQT>5.000000</ALQT>
   <BUAR>CSD</BUAR>
   <CFC3>01</CFC3>
   <CFC8>11</CFC8>
   <CFC9>02</CFC9>
   <CFI3>1</CFI3>
   <CFI4>PEPSI</CFI4>
   <CONA>2013060</CONA>
   <CUA1>IDS LOGISTICS SERVICES (M) SDN BHD</CUA1>
   <CUA2>NO 2, JALAN 26/35</CUA2>
   <CUA3>SECTION 26, 40000 SHAH ALAM</CUA3>
   <CUA4>SELANGOR</CUA4>
   <CUCL>043</CUCL>
   <CUNM>CARREFOUR AXIS PANDAN</CUNM>
   <CUNO>2013060</CUNO>
   <DLIX>4210228899</DLIX>
   <DSDT>20110624</DSDT>
   <DSHM>0</DSHM>
   <FRID>0</FRID>
   <FRTM>1</FRTM>
   <FUDS>Pet Pepsi 600ml x 24</FUDS>
   <GRWE>122.900</GRWE>
   <ITCL>20002</ITCL>
   <ITGR>243</ITGR>
   <ITNO>043002</ITNO>
   <ITTY>FG</ITTY>
   <LATD>0E-8</LATD>
   <LGTD>0E-8</LGTD>
   <MODL>001</MODL>
   <MOND>0</MOND>
   <NEWE>15.700</NEWE>
   <ORQT>5.000000</ORQT>
   <ORST>33</ORST>
   <PONO>40000</PONO>
   <RADS>0E-8</RADS>
   <RIDL>1</RIDL>
   <RIDN>0082899352</RIDN>
   <ROUT>C06SAS</ROUT>
   <SATD>0</SATD>
   <SDST>23</SDST>
   <SUND>0</SUND>
   <TEDL>CFR</TEDL>
   <THUD>0</THUD>
   <TOTM>235900</TOTM>
   <TUED>0</TUED>
   <VOL3>1.800</VOL3>
   <WEDD>0</WEDD>
   <WHLO>220</WHLO>
</LstDelByRLDTResponseItem>


I need to access the above xml directly by creating object for this file
and I need to get nodes names as properties.

Can anyone please help me?

[edit]SHOUTING and spurious bold removed, capitalization, and a bit of punctuation added - OriginalGriff[/edit]
Posted
Updated 9-Jul-11 2:48am
v2
Comments
OriginalGriff 9-Jul-11 8:49am    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.

1 solution

I'm not sure I fully understand. But from what I gathered, may I suggest LINQ To XML? Something like:

<br />
var nodes = (from n in xml.Descendants("LstDelByRLDTResponseItem").Elements()<br />
             select n);<br />
<br />
List<string> nodeNames = new List<string>();<br />
foreach (var node in nodes)<br />
{<br />
    nodeNames.Add(node.Name.LocalName);<br />
}<br />
</string></string>


Code may not be exact but I just started learning LINQ To XML recently.

http://msdn.microsoft.com/en-us/library/bb387098.aspx[^] -- For more information.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900