undeclared namespace prefix error - InfoPath Dev
in

InfoPath Dev

undeclared namespace prefix error

Last post 05-22-2006 08:44 PM by Matt Faus. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-22-2006 03:20 PM

    undeclared namespace prefix error

    I have a secondary data source based on a stored procedure. I'm using JScript to run the query on a button click. Data is returned fine and is displayed in the bound repeating table. Here is the xml from the debugger immediate window:

    ? XDocument.DataObjects("spSelManualCharges").DOM.xml
    "<dfs:myFields xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\"><dfs:dataFields>
    <d:ServiceDetail xmlns:d=\"http://schemas.microsoft.com/office/infopath/2003/ado/dataFields\" VendorID=\"3\" VendorAccount=\"Service1\" AmountBilled=\".0000\"/>
    <d:ServiceDetail xmlns:d=\"http://schemas.microsoft.com/office/infopath/2003/ado/dataFields\" VendorID=\"3\" VendorAccount=\"Service2\" AmountBilled=\".0000\"/>
    </dfs:dataFields></dfs:myFields>
    "

    But, when I try to access the data in JScript using MSXML methods, I get an "undeclared namespace" error:

    ? XDocument.DataObjects("spSelManualCharges").DOM.selectSingleNode("/dfs:myFields")
    Reference to undeclared namespace prefix: 'dfs'.

    There is an xmlns declaration for dfs in the XDocument so, I don't understand what is happening. BTW - There are several secondary sources on the form but no main data connection.

    Any help at all would be appreciated.

    Thank you,
    Crazy Raymo
  • 05-22-2006 04:38 PM In reply to

    Re: undeclared namespace prefix error

    The answer is at the following link:
    http://infopathdev.com/howto/tutorials/default.aspx?i=ed2cf0c5895f468995cdd081cf17fead

    The example is for an external xml file, but fixing a database access is almost the same. I just used the debugger to find what namespace prefix InfoPath had generated.
  • 05-22-2006 08:44 PM In reply to

    Re: undeclared namespace prefix error

    I'm glad the HowTo was helpful!

    You can also get the namespace that InfoPath has generated by looking at the very top of your code. There will be some configuration information in [] there.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.