in

InfoPath Dev

Declare a secondary namespce using JScript

Last post 12-20-2007 09:57 AM by Greg Collins. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 12-17-2007 02:38 PM

    Declare a secondary namespce using JScript

     I have a secondary data connection setup with a web service.  I am getting the following error when trying to reference those fields....

    The following error occurred:

    Reference to undeclared namespace prefix: 'tns'.

    File:script.js
    Line:716


    Unspecified error

    Do you have an examlpe of how to declare a namespace from a secondary data source using JScript?

     

    Filed under: ,
  • 12-18-2007 10:56 AM In reply to

    Re: Declare a secondary namespce using JScript

    xmlDoc.setProperty("SelectionNamespaces", "xmlns:tns='...namespace definition here...'");

    where xmlDoc is the XMLDOMDocument returned from XDocument.GetDOM()

    Visit my Web site:

    http://www.braintrove.com

    Greg Collins / Microsoft MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 12-18-2007 12:58 PM In reply to

    Re: Declare a secondary namespce using JScript

    my code look like this.. 

    var xmlDoc = XDocument.GetDOM("tns");xmlDoc.setProperty("SelectionNamespaces", 'xmlns:tns="http://rainpre.cs.boeing.com/webservices/adservices.asmx?WSDL"');

    but is get this error...

    InfoPath cannot open the selected form because of an error in the form's code.
    The following error occurred:

    A call to XDocument.GetDOM failed. The DataObject "tns" does not exist.
    File:script.js
    Line:15

     

     

    Filed under:
  • 12-19-2007 09:33 AM In reply to

    Re: Declare a secondary namespce using JScript

    tns is not a DOM, it is a namespace prefix that you want to define for the DOM you want to do your selections from.

    Also, your definition seems wrong... it seems unlikely that "?WSDL" is part of your definition. It looks more like you are providing a web service url rather than a namespace definition. The definition must match EXACTLY how it is specified in the XML file for that DOM or your selections will continue to fail.

    Visit my Web site:

    http://www.braintrove.com

    Greg Collins / Microsoft MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 12-19-2007 12:01 PM In reply to

    Re: Declare a secondary namespce using JScript

    You are right...I am trying to access a data source record that is tied to a web service.  As you can tell, I need a better understanding of how to setup my definitions.  I have attached what my data source looks like to make it easier for you to see what I need.  Thanks for all of youe help!

  • 12-20-2007 09:57 AM In reply to

    Re: Declare a secondary namespce using JScript

    Thanks... the image doesn't help much though.

    What you really need to do is open the GetUserInfo.xml file that is part of your form template. If you are using Visual Studio, close the manifest.xsf file, and then you can open this XML file. If you are directly in the InfoPath designer, then export your form files (File menu) and you can get to the .xml file.

    Once you open this file, you will see on the root node a list of namespace definitions. Copy all of these definitions, and use them in your .setProperty() call.

    You will use this same technique for any secondary data source you need to setup the namespaces for.

    Visit my Web site:

    http://www.braintrove.com

    Greg Collins / Microsoft MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (6 items)
Copyright © 2003-2007 Qdabra Software. All rights reserved.
View our Terms of Use.