XML/XHTML replace content?

Posted by Daveo on Stack Overflow See other posts from Stack Overflow or by Daveo
Published on 2010-05-24T01:29:56Z Indexed on 2010/05/24 1:41 UTC
Read the original article Hit count: 353

Filed under:
|
|

I have a XHTML string I want to replace tags in for example

<span tag="x">FOO</span> 
<span tag="y"> <b>bar</b> some random text <span>another span</span> </span>

I want to be able to find tag="x" and replace FOO with my own content and find tag=y and replace all the inner content with by own content.

What is the best way to do this? I am thinking regex is definitely out of the question. Can XPATH do this or is that just for searching can it do manipulation?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET