Advanced replace in C#

Posted by Andreas on Stack Overflow See other posts from Stack Overflow or by Andreas
Published on 2010-05-18T10:48:29Z Indexed on 2010/05/18 10:51 UTC
Read the original article Hit count: 194

Filed under:
|
|
|

Hi, I like to replace some attributes inside a xml (string) with c#.

Example xml:

<items>
  <item x="15" y="25">
    <item y="10" x="30"></item>
  </item>
  <item x="5" y="60"></item>
  <item y="100" x="10"></item>
</items>

In this case I like to change the x-attributes to the combined value of x and y.

Result xml:

<items>
  <item x="40" y="25">
    <item y="10" x="40"></item>
  </item>
  <item x="65" y="60"></item>
  <item y="100" x="110"></item>
</items>

© Stack Overflow or respective owner

Related posts about c#

Related posts about replace