saving XML file usinf XMLDoc

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Patrick.O.Ige

    saving XML file usinf XMLDoc

    I have this small snippet below and i want to save some data back to the xml
    file.
    So i looked for a node and checked if the node value is the same as a
    textbox value
    and if yes i pass in the new value entered from a textbox back t the xml
    datasource.
    I'm populating values of the textboxes from an xml dtrasource
    But it doesn't see to work am i missing something
    Thanks in advance

    string g = bbW;

    if (node["Weighting"].InnerText == Weighting.Text)

    {

    node["Weighting"].InnerText = g;

    }

    -------------------------------------------------
    code below

    public void saveXmlData(str ing bbW)

    {

    XmlDocument xmlDocument = new XmlDocument();

    xmlDocument.Loa d(Server.MapPat h("WT.xml"));

    XmlNodeList nodeList = xmlDocument.Sel ectNodes("//WeightingsRep") ;


    foreach (XmlNode node in nodeList)

    {

    //Response.Write( "todd:" + bbW);




    string g = bbW;

    if (node["Weighting"].InnerText == Weighting.Text)

    {

    node["BBWeightin g"].InnerText = g;

    }


    }

    xmlDocument.Sav e(Server.MapPat h("WT.xml"));



    xmlDocument = null;





    }


  • Patrick.O.Ige

    #2
    Re: saving XML file usinf XMLDoc

    Forgot my XML doc looks like this :-
    <?xml version="1.0" encoding="utf-8"?>
    <Figures>
    <Rep>
    <Weighting>0.07 08</Weighting>
    </Rep>
    </Figures>

    Thanks


    "Patrick.O. Ige" <naijacoder@hot mail.comwrote in message
    news:OERyJheEHH A.1012@TK2MSFTN GP04.phx.gbl...
    I have this small snippet below and i want to save some data back to the
    xml
    file.
    So i looked for a node and checked if the node value is the same as a
    textbox value
    and if yes i pass in the new value entered from a textbox back t the xml
    datasource.
    I'm populating values of the textboxes from an xml dtrasource
    But it doesn't see to work am i missing something
    Thanks in advance
    >
    string g = bbW;
    >
    if (node["Weighting"].InnerText == Weighting.Text)
    >
    {
    >
    node["Weighting"].InnerText = g;
    >
    }
    >
    -------------------------------------------------
    code below
    >
    public void saveXmlData(str ing bbW)
    >
    {
    >
    XmlDocument xmlDocument = new XmlDocument();
    >
    xmlDocument.Loa d(Server.MapPat h("WT.xml"));
    >
    XmlNodeList nodeList = xmlDocument.Sel ectNodes("//WeightingsRep") ;
    >
    >
    foreach (XmlNode node in nodeList)
    >
    {
    >
    //Response.Write( "todd:" + bbW);
    >
    >
    >
    >
    string g = bbW;
    >
    if (node["Weighting"].InnerText == Weighting.Text)
    >
    {
    >
    node["BBWeightin g"].InnerText = g;
    >
    }
    >
    >
    }
    >
    xmlDocument.Sav e(Server.MapPat h("WT.xml"));
    >
    >
    >
    xmlDocument = null;
    >
    >
    >
    >
    >
    }
    >
    >

    Comment

    Working...