Please help me...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sudhin acharya
    New Member
    • Aug 2010
    • 1

    #1

    Please help me...

    Code:
    <?xml version="1.0" encoding="utf-8" ?> 
      <string xmlns="http://tempuri.org/"><?xml version="1.0" encoding="utf-8"?><BTV><BTV_Input_Clinical><paramInput1 Name="EventCode">A03</paramInput1><paramInput2 Name="LastExecDateTime">2000/6/2</paramInput2></BTV_Input_Clinical><BTV_Output_Clinical>
    <Clinical_Data><Row0><EID>HJKL-GFHJ-AZCD-1234</EID><MRN>200004</MRN><PhysicianID>XA12345</PhysicianID></Row0><Row1><EID>MKLM-GFHJ-AZCD-1234</EID><MRN>200006</MRN><PhysicianID>XA12345</PhysicianID></Row1><Row2><EID>NNNN-GFHJ-AZCD-1234</EID><MRN>200005</MRN><PhysicianID>XA12345</PhysicianID></Row2><Row3><EID>QWER-GFHJ-AZCD-1234</EID><MRN>200003</MRN><PhysicianID>XA12345</PhysicianID></Row3><Row4><EID>SSUD-GFHJ-AZCD-1234</EID><MRN>2003</MRN><PhysicianID>XA12345</PhysicianID></Row4><Row5><EID>ZXSE-GFHJ-AZCD-1234</EID><MRN>200002</MRN><PhysicianID>XA12345</PhysicianID></Row5></Clinical_Data><Status>Success</Status><Message>Data Retrived Successfully</Message></BTV_Output_Clinical></BTV></string>
    Above string is in xml format.Now i want to traverse through string and store the values of EID,MRN and physician ID in a variable and pass this three variables to stored proecdure which are its input parameter.In the above string there are 5 Rows which contain the data.My c# code should fetch EID ,MRN and Physician ID from Row 0.this values should be passed to stored proecdure.Once it gets executed it should fetch the data from ROW 1 and do the same..This behaviour should be repeated till Row 6 is traversed.

    PLease help me urgently..I am stuck up...
    Last edited by Niheel; Aug 16 '10, 07:33 PM.
  • Sfreak
    New Member
    • Mar 2010
    • 64

    #2
    Sudhin,

    There are many ways to parse an XML file. One way is using XmlNodeList as the example below:

    Code:
    private XmlDocument XmlFile = new XmlDocument();
     if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    this.XmlFile.Load(openFileDialog.FileName);
                }
    XmlNodeList NodeList = XmlFile.GetElementsByTagName("TagName1");
                foreach (XmlNode node in NodeList)
                {
                    XmlElement element = (XmlElement)node;
                    MessageBox.Show(element.GetElementsByTagName("TagName")[0].InnerText);
                    MessageBox.Show(element.GetElementsByTagName("TagName2")[0].InnerText);
                }
    Hope this can help you...

    Fernando Mello

    Comment

    Working...