Reference to undeclared namespace prefix

A

abc

Hi

I am struggling to access a field using JScript from an aspx web page.
I am basically following the instructions here:

http://blogs.msdn.com/rrawat/archive/2006/08/09/693118.aspx

When my code runs I get the message
Reference to undeclared namespace prefix: 'my'.

My code is:
<script language=jscript>
var oApp = new ActiveXObject("InfoPath.Application");
var oXDocument = oApp.XDocuments.NewFromSolution("http://abc999/
Template1.xsn");
var oParam = oXDocument.DOM.selectSingleNode("//my:TestPram")
alert(oParam.text);
oApp = null;
</script>

I created the field TestPram in my InfoPath form by right clicking
MyFields, clicking Add, typed the name TestPram and clicked OK.

This prefix exists because if I run:
alert(oXDocument.DOM.xml);

I get the following output:

<?xml version="1.0"?>
<?mso-infoPathSolution solutionVersion="1.0.0.14" initialView="View 1"
productVersion="11.0.6565" PIVersion="1.0.0.0" href="http://agl0057855/
template1.xsn" name="urn:schemas-microsoft-
com:eek:ffice:infopath:template1:-dataFormSolution" ?>
<?mso-application progid="InfoPath.Document"?>
<dfs:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:q="http://schemas.microsoft.com/office/infopath/2003/ado/
queryFields" xmlns:d="http://schemas.microsoft.com/office/infopath/
2003/ado/dataFields" xmlns:dfs="http://schemas.microsoft.com/office/
infopath/2003/dataFormSolution" xmlns:my="http://schemas.microsoft.com/
office/infopath/2003/myXSD/2007-08-07T06:23:54" xmlns:xd="http://
schemas.microsoft.com/office/infopath/2003" xml:lang="en-au">
<dfs:queryFields>
<q:Wells WellName="" WellStatus="" PPL="" StageNo="" Area=""></
q:Wells>
</dfs:queryFields>
<dfs:dataFields>
<d:Wells WellName="" WellStatus="" PPL="" StageNo="" Area=""></
d:Wells>
</dfs:dataFields>
<my:TestPram>abc</my:TestPram>
</dfs:myFields>

thanks
TJ
 
A

abc

This link provides information about setting up namespaces to a
secondary data sources. I am not using a secondary data source. I am
trying to access a new field on my main data source. As you can see
from the code I posted the namespace 'my' is listed. I tried an
another example using a blank form without a database datasource and
the problem went away. So maybe it is something to do with the dfs
namespace.

anymore ideas?
TJ
 

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