Easy way to read xml up to a specified element?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Given this sample XML document is there a simple way to read AND collect all Xml until <TargetElement> node? Currenty, as we read thru the XML we check for StartElement, EndElement, Text nodes, extract values and concat them into a string. Is there
a better way to do this? Obviously we can only consider XmlTextReader as this is designed to manipulate XML in a pipeline.
<pre lang="x-xml <RootNode>
<ParentNode>
<ChildNode>
<TargetElement>Some Value</TargetElement>
</ChildNode>
</ParentNode>
</RootNode>
[/code]


View the full article
 
Back
Top