Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

Replace\Update the xmlNode with supplied value in XML document

$
0
0

In XML document we search the xmlNodes depending on xpath and then we want to replace the xmlNodes completely with the supplied value.

for Example

OracleXmlType has the below data and Xpath is set to "/RESUME/NAME"

<?xml version="1.0"?>
<RESUME>
    <NAME>Name0</NAME>
    <NAME>Name1</NAME>

    <EXPERIENCE>
       <YEARS>0</YEARS>
    </EXPERIENCE>
</RESUME>


the value we want to replace as below which is supplied as string

<RESUME>
    <NAME>Name0</NAME>
    <NAME>Name1</NAME>
</RESUME>


the expected result is

~~~~~~~~~~~~~~~

<?xml version="1.0"?>
<RESUME>
   <RESUME>
        <NAME>Name0</NAME>
        <NAME>Name1</NAME>
    </RESUME>
   
<RESUME>
         <NAME>Name0</NAME>
         <NAME>Name1</NAME>
     </RESUME>
    <EXPERIENCE>
       <YEARS>0</YEARS>
    </EXPERIENCE>
</RESUME>

please tell me the efficient way to achieve the above functionality using the .NET XML related APIS






Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>