1

Im loading an xml from stream

       XDocument xmlFile = XDocument.Load(stream);
       var query = from c in xmlFile.Elements("//Band")    //error here
                   select c;

modify query....

Is it possible to find elements which are in format of Xpath ? (//Band) ?

p.s. I can use descendants but I want to ask about xpath....

Charles
  • 50,943
  • 13
  • 104
  • 142
Royi Namir
  • 144,742
  • 138
  • 468
  • 792

1 Answers1

0

Use the Descendants() method:

from c in xmlFile.Descendants("Band")
  select c;

Or if you want to specify true XPath expressions, use the following Extensions:

Dimitre Novatchev
  • 240,661
  • 26
  • 293
  • 431