I have to following XML file:
<root xmlns="http://someurl/element" xmlns:text="http://someurl/text">
<elements>
<element>
<Id>text:SOME_ID</Id>
<!-- some other elements -->
</element>
<element>
<!-- some other elements -->
<reference>
<link ref="text:SOME_ID" />
</reference>
</element>
</elements>
</root>
I want to select all child elements of the elment node which have the element Id=text:SOME_ID, how can i get it using xmldocument method
From your question it is not entirely clear to me what you want to select but I assume you want to select
<element>having child<Id>with contenttext:SOME_ID.If you insist on using
XmlDocumentyou can use it like this:However, I recommend using LINQ to XML: