Link to home
Start Free TrialLog in
Avatar of ChadMarsh
ChadMarshFlag for United States of America

asked on

Renaming nodes in an XML file

Hello,
I wrote a wrapper to consume a proprietary web service. It works good except the xml that the web service returns has some child nodes that are the same as the parent node so my dataset ignores the child.
Since I can't get the source to the webservice to change it, Would there be way I could loop through the file aand change either one so they are not the same?  If I manually run the service, save the file, and edit the value it works fine.  Here is an example
<responsible>
     <responsibleid>123456789</responsibleid>
    <responsible>John Smith</responsible>
</responsible>
The web services returns it as a string so this is what I'm using to put it in a dataset
public DataSet tickets()
        {
            EntryWrapper.entry.Service1 ticket = new EntryWrapper.entry.Service1();
            ticket.Credentials = new System.Net.NetworkCredential("name", "password", "OGI");
            string strWeb = ticket.ReportTest("F241A905-89B1-416d-8DC2-8C2EA1A6B434", "");
            XmlTextReader xml_reader = new XmlTextReader(new StringReader(strWeb));
            DataSet relational_data = new DataSet("ogi_team");
            relational_data.ReadXml(xml_reader);
            return relational_data;
        }
Thanks for any help
ASKER CERTIFIED SOLUTION
Avatar of rgavrilov
rgavrilov

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ChadMarsh

ASKER

Excellent! Thanks.