XML : Is there a way to replace whole XML node at once?

I need to replace a list of products (UserCart) with updated list of products for specified user. How can I do that without calling each property?

  <Users>  <UserInfo>    <Name>ddd</Name>    <Wallet>0</Wallet>    <UserCart>      <Products_>        <MedicineProduct          Product_Name="sak"          Product_ID="0"          Price="0"          Quntity="0"          Image="" />      </Products_>    </UserCart>  </UserInfo>    

Here's where I stuck...

  public static void Edit(UserInfo user, Products usercart)  {      XmlDocument doc = new XmlDocument();      doc.Load(path);      XmlNode node = doc.SelectSingleNode(string.Format("//UserInfo[./Name/text()='{0}']", user.Name));  }    

Found specified user. How do I replace whole UserCart node with new value?

No comments:

Post a Comment