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?
If you’re sure the content is XHTML (i.e. well-formed XML) then XPath can certainly do it.