replace a main node with web service return - InfoPath Dev
in

InfoPath Dev

replace a main node with web service return

Last post 11-25-2005 04:40 PM by Richard. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 11-24-2005 10:11 PM

    replace a main node with web service return

    I am trying to replace the option node in the main with the results returned from webservice.
    option happens to be in a row of a repeating table.


    IXMLDOMNode OldChild = thisXDocument.DOM.selectSingleNode("/my:myFields//my:Choices/my:Choice["+System.Convert.ToString(currow)+"]/my:option");

    IXMLDOMNode NewChild = wsDOM.selectSingleNode("/dfs:myFields/dfs:dataFields/tns:MarkLogicDistinctQueryResponse/tns:MarkLogicDistinctQueryResult/result/option");

    OldChild.parentNode.replaceChild(NewChild,OldChild);

    I get the following error:
    System.Runtime.InteropServices.COMException
    Element 'option' is unexpected according to content model of parent element 'http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-04-05T18-57-23}Choice'.
    Expecting: http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-04-05T18-57-23}option.

    is this because web return has no namespace my: ?
    if so how do I get around that ?
  • 11-24-2005 11:14 PM In reply to

    Re: replace a main node with web service return

    Hi,

    Yes when you do a replacenode you need to have the same node with the same prefix of namespace!

    He has lot of work around:

    Make a replace in your node !
    Make your form with your custom schema without namespace!
    Change the webservice return!
    Replace only the text not the node!
    ...

    ++

    Thierry

    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 11-25-2005 04:40 PM In reply to

    Re: replace a main node with web service return

    I changed the webservice to include the xmlns:my and it worked fine.

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