reading the xml values - InfoPath Dev
in

InfoPath Dev

reading the xml values

Last post 04-26-2013 07:56 AM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-22-2013 12:48 PM

    reading the xml values

    Herewith I am attaching an xml file. I wanted to read the values and loop through the elements and get the individual values. How can I do that?

    XPathNavigator myNav = MainDataSource.CreateNavigator();
    XPathNodeIterator nodes = myNav.Select("my:meetingAgenda/my:Agenda/my:agenda_NewBusinessGroup/my:agenda_newBusinessRepeatSection", NamespaceManager);//Repeating table
                if (nodes.MoveNext())
                {
                    XPathNavigator nodesNavigator = nodes.Current;

                   
                    XPathNodeIterator nodesText =
                       nodesNavigator.SelectDescendants(XPathNodeType.Text,false);

                    while (nodesText.MoveNext())
                    {

                        //Console.WriteLine(nodesText.Current.Value);
                    }
                }

     

    This one loops through but I need to use selectsinglenode to get the values.

  • 04-26-2013 07:56 AM In reply to

     I usually use foreach, like this example from MSDN.

    foreach (XPathNavigator n in nodeIterator)
        Console.WriteLine(n.LocalName);

    EDITED TO ADD: Gee, I didn't entirely answer the question there - n.Value gets you the value of the node in the sample above.

    Hilary Stoupa

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.