How to query xml data when loaded into datatable

  • Thread starter Thread starter Sudip_inn
  • Start date Start date
S

Sudip_inn

Guest
this is my sample xml. see it first please

<?xml version = "1.0" encoding = "utf-8"?>
<comment>
<commenttext>blah blah blah</commenttext>
<ignoredata>true</ignoredata>
<ignorevalue>100</ignorevalue>
</comment>
<?xml version = "1.0" encoding = "utf-8"?>
<comment>
<commenttext>blah1 blah1 blah1</commenttext>
<ignoredata>true</ignoredata>
</comment>
<comment>
<commenttext>blah2 blah2 blah2</commenttext>
<ignoredata>false</ignoredata>
</comment>
<comment>
<commenttext>blah3 blah3 blah3</commenttext>
<ignoredata>true</ignoredata>
</comment>
<comment>
<commenttext>blah4 blah4 blah4</commenttext>
<ignoredata>true</ignoredata>
<ignorevalue/>
</comment>
<comment>
<commenttext>blah5 blah5 blah5</commenttext>
<ignoredata>true</ignoredata>
<ignorevalue>201</ignorevalue>
</comment>

i have two questions on above xml.

1) how to determine how many records has ignoredata == true and ignorevalue element is missing ?

2) i will convert my the above datatable to list and after that how could i iterate only in those records which has ignoredata == true and ignorevalue element is missing to update ignorevalue with hard code value like -1

in my abobe xml some time ignoredata has true value but there is no ignorevalue element in that records and some time again ignoredata has true value but there is empty tag of ignorevalue

please share code example for my above 2 questions. thanks

Continue reading...
 
Back
Top