To another challenge. I looked through some of the questions I found here, but I canβt put together what I need.
OK I have an XML file:
<Output id="1"> <path rename="Off" name="pattern-1">d:\temp</path> </Output> <Output id="2"> <path isRename="False" name="pattern-1" >d:\temp\out2</path> <path isRename="True" name="pattern-1" >d:\temp\out3</path> <path isRename="False" name="pattern-1">d:\temp\out4</path> </Output>
I need to find the <Output> tag based on the id attribute. Then I need to skip all the <path> tags and get the attribute and path value. I tried several things based on the previous question that I asked, but I could not get it to work.
var results = from c in rootElement.Elements("Output") where (string)c.Attribute("Id") == "2" select c; foreach (var path in rootElement.Elements("Output").Elements("path")) { string p = path.Value; }
source share