How to copy nodes between two datasources(xmldocuments) - InfoPath Dev
in

InfoPath Dev

How to copy nodes between two datasources(xmldocuments)

Last post 08-01-2008 07:34 AM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-01-2008 05:39 AM

    How to copy nodes between two datasources(xmldocuments)

     I need to copy node List1 and its child nodes:

    -<List1>

    --Item1

    --Item2 

    </List1>

    to dokument like:

    <Lists> (repeting fields)

     -<List1>

    ---Item1

    ---Item2 

    -</List1>

    -<List2>

    ---Item1

    ---Item2 

    -</List2>

    ... 

    </Lists> 

     

  • 08-01-2008 05:49 AM In reply to

    • Anuma
    • Top 25 Contributor
      Female
    • Joined on 07-20-2005
    • India
    • Posts 525

    Re: How to copy nodes between two datasources(xmldocuments)

    Hi,

     

    Create “Lists” repeating group in the schema. Select List1 node and right click on the mouse. Select “Move” option and select “Lists” in the “Move Field or group” window. Click on ok.

     

    I hope this will help you.

     

    Anuma Chinthapalli /
    http://www.GGKTech.com
  • 08-01-2008 06:44 AM In reply to

    Re: How to copy nodes between two datasources(xmldocuments)

    Thank you for answer but still I have  problem.

    Can i with this solution below, copy/append Item[2] in MainDataSource:

    try
                {
                   
                    DataSource ds = DataSources["ReadFromDB"];
                    
                    ds.QueryConnection.Execute();

                    string xpath = "/dfs:myFields/dfs:dataFields/tns:Response/tns:Result";
                    string value = ds.CreateNavigator().SelectSingleNode(xpath, NamespaceManager).InnerXml;
                            
                   
                    XPathNavigator nav = this.MainDataSource.CreateNavigator();
                    string sFromChoice = nav.SelectSingleNode("/dfs:myFields/my:myFields/my:Items", NamespaceManager).Value;
           
                    
                    
                    xpath = "dfs:myFields/dfs:dataFields/tns:ReadResponse/tns:ReadResult/tns:Item[2]";
                     
                    XPathNavigator xn = ds.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
                   
                                    
                    xpath = "/dfs:myFields/dfs:dataFields/tns:MainResponse/s1:MainResult/s1:List";
                    MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager).AppendChild(xn);
                }

    Now i have exception with : Schema validation found non-data type errors.

    That's mean a have to search problem with shemas or that code is totaly wrong?
     

  • 08-01-2008 07:34 AM In reply to

    Re: How to copy nodes between two datasources(xmldocuments)

    This error is also caused by the xsi:nil attribute -- see this blog post by the InfoPath team for more information and guidance.

    Hilary Stoupa

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