Bytech India
asked on
LINQ for reading an XML file
Dear All
Using LINQ,I wanted to search all the cities starting with specific series of characters from the attached sample XML file format.
I am completly new to LINQ.
I am using following lines for the extraction,.but facing some issue.Please help.
************************** ********** ********** ********** ********** ********** ********** *
var Locations = from city in doc.Root.Elements("row").A ttributes( "CITY")
where city.Value.StartsWith(Filt er)
select city;
************************** ********** ********** ********** ********** ********** ********** *
Thanks in advance.
Sample.xml
Using LINQ,I wanted to search all the cities starting with specific series of characters from the attached sample XML file format.
I am completly new to LINQ.
I am using following lines for the extraction,.but facing some issue.Please help.
**************************
var Locations = from city in doc.Root.Elements("row").A
where city.Value.StartsWith(Filt
select city;
**************************
Thanks in advance.
Sample.xml
which issus?
ASKER
Sir,instead of array of city in Locations variable I am getting System.Linq.Enumerable+Whe reEnumerab leIterator `1[System. Xml.Linq.X Attribute] .
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you so much sir.. It worked.. Thanks a lot...
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for BYTECHINDIA's comment #a40387987
for the following reason:
I applied the code and it worked.. Thats great..
Accepted answer: 0 points for BYTECHINDIA's comment #a40387987
for the following reason:
I applied the code and it worked.. Thats great..
Hi BYTECHINDIA;
Did you mean that you applied the code I posted and it worked? If that is the case you selected the wrong solution as the accepted solution and please have the question re-open so that you may select the correct answer.
Thanks.
Did you mean that you applied the code I posted and it worked? If that is the case you selected the wrong solution as the accepted solution and please have the question re-open so that you may select the correct answer.
Thanks.
ASKER
I want to reopen this question just because I think by mistake I have accepted the wrong answer as solution.