How to select child nodes when parent node equals a specific value in LINQ to XML

Joker85

New Member
Part of an application I am building needs to generate a robots.txt file from an XML document.I have XML like so :\[code\]<root> <Robots> <UserAgents> <UserAgent>*</UserAgent> <Disallow> <Item>/wibble/</Item> <Item>/wobble/</Item> </Disallow> </UserAgents> <UserAgents> <UserAgent>Google</UserAgent> <Disallow> <Item>/</Item> </Disallow> </UserAgents> </Robots></root>\[/code\]How can I select the "Items" where the UserAgent = "*"?In other words I want to select the child nodes only when a parent node equals a certain value. The value in the parent node will be unique.I am using C# in ASP.net.
 
Back
Top