Edit Xml node
Posted on 2009-02-10
I am trying to write a portion of a C# app that runs through an XML file and html encodes the text found in a specific node, <SectionText>:
<![CDATA[<br />This is the node that needs to be html encoded.<br/ ><br />]]>
I have the html encode part written. It encodes a given string.
I tried using a streamreader because the files can be large (one is 170MB). I was using the methods of readline and writeline to loop through and edit the nodes, but it soon became too complicated to capture the full or partial segments of the target node that might be in a line read by the streamreader.
I was thinking of trying Xpath, but thought the file size might be an issue.
Do you have suggestions on either using XPath or a better way to read through the file and get the target substrings, html encode them and replace the substring with the html encoded version?
Thanks very much,