Processing XML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sp22403
    New Member
    • May 2010
    • 1

    Processing XML

    Hi, I have a scenario as follows... can someone guide me a suitable solution?

    1) I retrieve an XML string from database.

    2) I need to modify an XmlNode attribute at runtime based on user input.

    3) I need to to pass the updated XML string to code downstream.


    Currently I am retirveing the XML structure and able to modify the node attribute by using the code as below.

    XmlDocument xmldoc = new XmlDocument();
    xmldoc.LoadXml (<xml structure>);
    xmlDoc.Document Element.SetAttr ibute("attribut ename","user input");

    Then I am not sure how to pass this updated XML string to code downstream.

    Is there a way to do this without saving the XMLDocument?

    Or

    Is there a better way to manipulate the XML string and get handle to the XML string to use for further processing?

    Please help.
  • ThatThatGuy
    Recognized Expert Contributor
    • Jul 2009
    • 453

    #2
    Originally posted by Sp22403
    Hi, I have a scenario as follows... can someone guide me a suitable solution?

    1) I retrieve an XML string from database.

    2) I need to modify an XmlNode attribute at runtime based on user input.

    3) I need to to pass the updated XML string to code downstream.


    Currently I am retirveing the XML structure and able to modify the node attribute by using the code as below.

    XmlDocument xmldoc = new XmlDocument();
    xmldoc.LoadXml (<xml structure>);
    xmlDoc.Document Element.SetAttr ibute("attribut ename","user input");

    Then I am not sure how to pass this updated XML string to code downstream.

    Is there a way to do this without saving the XMLDocument?

    Or

    Is there a better way to manipulate the XML string and get handle to the XML string to use for further processing?

    Please help.
    You can use the InnerXml property of XmlDocument...

    to fetch the whole Xml as a string then you can save it to the database

    Comment

    Working...