Incorrect path - InfoPath Dev
in

InfoPath Dev

Incorrect path

Last post 01-02-2007 11:55 PM by diaboloche. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 01-02-2007 03:20 AM

    Incorrect path

    Hi,

    I wish to recover this value:



    /my:myFields/my:dataFields/GetAnnonce2Response/GetAnnonce2Result/:NewDataSet/(choice)/tbAnnonces/NUM


    My path is incorrect... Can somebody correct me? Thank you

    (Sorry for my english...)
  • 01-02-2007 04:28 AM In reply to

    Hi

    You need to define 'tns' prefix for "GetAnnonce2Response" group.The correct Xpath is

    /my:myFields/my:dataFields/tns:GetAnnonce2Response/tns:GetAnnonce2Result/tns::NewDataSet/tns:tbAnnonces/tns:NUM

    To find the correct xpath and their prefixes, open the xml file which you have attached as secondary datasource in editor mode i.e. in notepad or in Visual studio.
    Madhuri
    http://www.ggktech.com
  • 01-02-2007 04:53 AM In reply to

    Thanks, but i have an error...



    L'erreur suivante s'est produite :

    Référence à un préfixe d'espace de noms non déclaré : 'tns'.

    Fichier :script.js
    Ligne:167


    Unspecified error



    i do not understand...
  • 01-02-2007 05:14 AM In reply to

    Hello Diaboloche,
    You have to give the namespace for tns in your code.

    Hope this helps!
  • 01-02-2007 05:26 AM In reply to

    Hi,
    After getting the DOM, you set property for the DOM.
    Follow the steps given below
    <namespacesDefinition>
    var secondaryDOM = XDocument.GetDOM("Secondary DOM Name");
    secondaryDOM.setProperty "SelectionNamespaces",XXXX(give the name space of the Xml of the secondary data source here)
    </namespacesDefinition>
    and now use the Xpath mentioned above.

    Hope this helps you!
    Shilpa
    INFOPATHDEV India
  • 01-02-2007 06:49 AM In reply to

    Thanks :-)

    But i have the same error.


    XDocument.DOM.setProperty("SelectionNamespaces", 'xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-05T08:48:33"');

    var secondaryDOM = XDocument.GetDOM("AfficheAnnonce");
    secondaryDOM.setProperty("SelectionNamespaces",'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:tns="http://tempuri.org/" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-05T08:48:33" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:_xdns0="http://schemas.microsoft.com/office/infopath/2003/changeTracking" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"');



    and


    XDocument.DOM.selectSingleNode('/my:myFields/my:dataFields/tns:GetAnnonce2Response/tns:GetAnnonce2Result/tns::NewDataSet/tns:tbAnnonces/tns:NUM');


    My XML secondary datasource :



    Where am I to mislead?

    - <dfs:myFields xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:tns="http://tempuri.org/" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-05T08:48:33" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:_xdns0="http://schemas.microsoft.com/office/infopath/2003/changeTracking" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    - <dfs:queryFields>
    <tns:GetAnnonce2 />
    </dfs:queryFields>
    - <dfs:dataFields>
    - <tns:GetAnnonce2Response>
    - <tns:GetAnnonce2Result>
    - <NewDataSet>
    - <tbAnnonces>
    <NUM />
    <NOM />
    <NOM1 />
    <NOM2 />
    <EMPLACEMENT />
    <LOCALITE />
    <MAGASIN />
    <ZONE />
    <ADRESSE />
    <OPERATION />
    <NOMOP />
    <TYPE />
    <NOMTYPE />
    <PAYSOR />
    <PAYSPROV />
    <NBRE />
    <ORIGINE />
    <POIDSBRUT />
    <POIDSNET />
    <POIDSCOND />
    <TARE />
    <RECEPTION />
    <CREATION />
    <DATEDEDOU />
    <CONTREMARQUE />
    <TRANSPORTEUR />
    <PRIX />
    <REFDOCD />
    <LIEUDD />
    <NUMLOT />
    <LIBRE />
    <NUMBALLES />
    <URLANNONCE />
    <DESCTYPE />
    </tbAnnonces>
    </NewDataSet>
    </tns:GetAnnonce2Result>
    </tns:GetAnnonce2Response>
    </dfs:dataFields>
    </dfs:myFields>
  • 01-02-2007 08:04 AM In reply to

    Hi diaboloche,

    You might want to check out this HowTo for setting up namespaces:http://infopathdev.com/howto/tutorials/default.aspx?i=ed2cf0c5895f468995cdd081cf17fead

    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-02-2007 08:19 AM In reply to

    Thank you for your answer. But I have difficulties...

    My XML :

    <dfs:myFields xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:tns="http://tempuri.org/" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-05T08:48:33" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:_xdns0="http://schemas.microsoft.com/office/infopath/2003/changeTracking" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">


    My declaration :

    XDocument.GetDOM("AfficheAnnonce").setProperty("SelectionNamespaces",'xmlns:tns="http://tempuri.org/"');


    And my selectSingleNode :

    XDocument.DOM.selectSingleNode('/my:myFields/my:dataFields/tns:GetAnnonce2Response/tns:GetAnnonce2Result/tns::NewDataSet/tns:tbAnnonces/tns:NUM');


    Sorry, my English is bad, and sometimes I have problems for details. Thanks a lot !
  • 01-02-2007 03:49 PM In reply to

    Hi,

    Look what you have in your xml:
    <dfs:myFields >
    - <dfs:queryFields>
    <tns:GetAnnonce2 />
    </dfs:queryFields>
    - <dfs:dataFields>
    <tns:GetAnnonce2Response>
    ...


    and what you have write:

    quote:
    XDocument.DOM.selectSingleNode('/my:myFields/my:dataFields/tns:GetAnnonce2Response...


    I think that can go better if you write this

    XDocument.DOM.selectSingleNode('/dfs:myFields/dfs:dataFields/tns:GetAnnonce2Response...

    And don't forget to declare the dfs namespace ;)

    ++

    Thierry
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 01-02-2007 11:55 PM In reply to

    Thanks a lot Mister Virgul !

    Bonne année !
Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.