Update XML Attribute (attribute)

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

There is a XML document, an attribute "PK" is wrong, the correct is 2. How do we make it change correctly?

The original XML document as follows:

<?xml version="1.0" encoding="utf-8"?>
<ProcessSorts>
  <ProcessSort pk="0">
    <ProcessSortName>Direct process</ProcessSortName>
  </ProcessSort>
  <ProcessSort pk="1">
    <ProcessSortName>Indirect procedure 1</ProcessSortName>
  </ProcessSort>
  <ProcessSort pk="7">
    <ProcessSortName>Indirect procedure 2</ProcessSortName>
  </ProcessSort>
  <ProcessSort pk="3">
    <ProcessSortName>Indirect procedure 3</ProcessSortName>
  </ProcessSort>
  <ProcessSort pk="4">
    <ProcessSortName>Indirect procedure 4</ProcessSortName>
  </ProcessSort>
</ProcessSorts>

ProcessSort.xml

The following Insus.NET use the asp.net program to update it, the first use of a few namespace:

using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;

Update the code example:

Webpage after operation, open the XMl document again

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Reuben at November 14, 2013 - 5:06 AM