Lost and new help with select singlenode

J

JoeAtPMHCC

I am really struggling with this. While it seems trivial we can't seem to
find our way.
We are using vb.net and infopath.
I can easily reference values from vb that are in my primary dayasource such
as
thisXDocument.DOM.selectSingleNode("/my:myFields/my:eek:ther").text
but no matter how many combination I try I can't seem to reference values in
my secondary datasources.
this code
thisXDocument.GetDOM("EmploymentType_Look").selectSingleNode("/dfs:myFields/dfs:dataFields/d:EmploymentType_Look/@EmploymentTypeDesc").text returns
Reference to undeclared namespace prefix: 'dfs'.
How do I select values in the GetDOM("EmploymentType_Look") and what am I
missing?
Any help would be greatly appreciated.........
Jb
 
W

wjasonstrutz

You need to set the Namespace property for all secondary data sources before
you can use the namespace referenced (which you have to do to get the data).

I prefer javascript to vb, so hopefully you'll be able to translate:
var myDoc = XDocument.getDOM("Secondary Data Source");
myDoc.setProperty("SelectionNamespaces",

'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" ' +

'xmlns:d="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"
');
myDoc.selectSingleNode("...")

Note the single quotes delimiting the second argument, so the double quotes
in the namespaces don't need to be escaped. You can set your namespace
prefixes to be whatever you want; you'll just have to remember what they are
when you reference them.

You can find the exact namespaces you will need to set in the data source in
the Infopath design view. Right click on a node or group, select Properties,
and click on the Details tab.

jason.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top