forum

Home / DeveloperSection / Forums / How add value on xml in specified node

How add value on xml in specified node

Royce Roy 1846 27-Jan-2014

I need write program on c#, which check, if exist node on xml. If not: insert value. So I have tree path: ./a/d and some line, which I need insert:

<e name="aaa" value="bbb" />

How read and insert value in correct place? This is original xml:

 <?xml version="1.0" encoding="utf-8"?>
    <a>
      <b>
      <c></c>
      </b>
    </a>

After , I need XML:

<?xml version="1.0" encoding="utf-8"?>
    <a>
      <b>
      <c></c>
      </b>
      <d>
        <e name="aaa" value="bbb" />
      </d>
    </a>

So, can you help me with code?


c# c# 
Updated on 27-Jan-2014

Can you answer this question?


Answer

1 Answers

Liked By