Namespace prefix not declare - InfoPath Dev
in

InfoPath Dev

Namespace prefix not declare

Last post 04-19-2010 06:13 AM by Jimmy. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 06-10-2009 05:34 AM

    • Martie
    • Not Ranked
    • Joined on 06-10-2009
    • Posts 1

    Namespace prefix not declare

    I have 2 forms, one form displaying the data with an "ADD EQUIPMENT" button and another form that is opened when the button is clicked for entering the new record.  The new form must then add this record and return to the first form.  On the second form I have a SAVE button that will add the record and return to the previous view. When I click on the SAVE button I am getting the following error:

     "Reference to undeclared namespace: "dfs""

     Not sure what the problem is.  I have declared the namespaces so there is most definitely something wrong with my declaration. 

    Here is my code.

     

    XDocument.DOM.setProperty "SelectionNamespaces", "xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"""

    XDocument.DOM.setProperty "SelectionNamespaces", "xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-13T09:33:48"""

     

    Sub CTRL81_19_OnClick(eventObj)

    dim ObjFieldsDataNode

    dim ObjEquipNode

    dim ObjNewEquipNode

    dim NewEquipNr

    dim NewDate

    dim NewCat

    dim NewDescrip

    dim NewMaintPlant

    dim NewFloc

    dim NewLoc

    dim NewSect

    dim NewWC

    dim NewABC

    dim NewSortField

    dim NewCostCenter

    dim NewPlanPlant

    dim NewPlnGrp

    dim NewMainWC

    dim NewMainWCPlt

    dim NewTPLNR

    dim NewObjectType

    dim NewSize

    dim NewInvetoryNr

    dim NewWeight

    dim NewUOM

    dim NewVendor

    dim NewAcqDate

    dim NedwAcqVal

    dim NewCurr

    dim NewManufact

    dim NewCYC

    dim NewYear

    dim NewMonth

    dim NewModel

    dim NewMSerNr

    dim NewMPartNr

    dim NewSerNr1

    dim NewSerNr2

    dim NewMatr

    dim NewPlant

    dim NewCompany

    dim NewWarranty

    Set ObjFieldsDataNode = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields")

    Set ObjEquipNode = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:Equipment_tbl")

    Set ObjNewEquipNode = ObjEquipNode.cloneNode(True) NewEquipNr = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:EquipNr").text

    NewDate = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Date").text

    NewCat = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Category").text

    NewDescrip = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Description").text

    NewMaintPlant = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:MaintPlant").text

    NewFloc = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Floc").text

    NewLoc = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Location").text

    NewSect = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Section").text

    NewWC = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:WC").text

    NewABC = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:ABC").text

    NewSortField = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:SortField").text

    NewCostCenter = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:CostCenter").text

    NewPlanPlant = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:PlanPlant").text

    NewPlnGrp = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:PlanGroup").text

    NewMainWC = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:MainWC").text

    NewMainWCPlt = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:MainWCPlant").text

    NewTPLNR = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:TPLNR").text

    NewObjectType = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:ObjectType").text

    NewSize = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Size").text

     NewInvetoryNr = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:InventoryNr").text

    NewWeight = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Weight").text

    NewUOM = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:UOM").text

    NewVendor = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Vendor").text

    NewAcqDate = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:AcqDate").text

    NedwAcqVal = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:AcqValue").text

    NewCurr = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Currency").text

    NewManufact = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Manufact").text

    NewCYC = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Country").text

    NewYear = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Year").text

    NewMonth = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Month").text

    NewModel = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Model").text

    NewMSerNr = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:ManufactSerialNo").text

    NewMPartNr = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:ManufactPartNo").text

    NewSerNr1 = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:SerialNo").text

    NewSerNr2 = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:SerialNr").text

    NewMatr = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:MatNr").text

    NewPlant = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:Plant").text

    NewCompany = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:CompanyCode").text

    NewWarranty = XDocument.DOM.selectSingleNode("/dfs:myFields/my:AddNew/my:WarrantyEndDate").text

    objNewEquipNode.attributes(0).text = NewEquipNr objNewEquipNode.attributes(1).text = NewDate

    objNewEquipNode.attributes(2).text = NewCategory objNewEquipNode.attributes(3).text = NewDescrip

    objNewEquipNode.attributes(4).text = NewMaintPlant objNewEquipNode.attributes(5).text = NewFloc

    objNewEquipNode.attributes(6).text = NewLoc objNewEquipNode.attributes(7).text = NewSect

    objNewEquipNode.attributes(8).text = NewWC

    objNewEquipNode.attributes(9).text = NewABC

    objNewEquipNode.attributes(10).text = NewSortField

    objNewEquipNode.attributes(11).text = NewCostCenter

    objNewEquipNode.attributes(12).text = NewPlanPlant

    objNewEquipNode.attributes(13).text = NewPlnGrp

    objNewEquipNode.attributes(14).text = NewMainWC

    objNewEquipNode.attributes(15).text = NewMainWCPlt

    objNewEquipNode.attributes(16).text = NewTPLNR

    objNewEquipNode.attributes(17).text = NewObjectType

    objNewEquipNode.attributes(18).text = NewSize

    objNewEquipNode.attributes(19).text = NewInvetoryNr

    objNewEquipNode.attributes(20).text = NewWeight

    objNewEquipNode.attributes(21).text = NewUOM

    objNewEquipNode.attributes(22).text = NewVendor

    objNewEquipNode.attributes(23).text = NewAcqDate

    objNewEquipNode.attributes(24).text = NedwAcqVal

    objNewEquipNode.attributes(25).text = NewCurr

    objNewEquipNode.attributes(26).text = NewManufact

    objNewEquipNode.attributes(27).text = NewCYC

    objNewEquipNode.attributes(28).text = NewYear

    objNewEquipNode.attributes(29).text = NewMonth

    objNewEquipNode.attributes(30).text = NewModel

    objNewEquipNode.attributes(31).text = NewMSerNr

    objNewEquipNode.attributes(32).text = NewMPartNr

    objNewEquipNode.attributes(33).text = NewSerNr1

    objNewEquipNode.attributes(34).text = NewSerNr2

    objNewEquipNode.attributes(35).text = NewMatr

    objNewEquipNode.attributes(36).text = NewPlant

    objNewEquipNode.attributes(37).text = NewCompany

    objNewEquipNode.attributes(38).text = NewWarranty

    call ObjFieldsDataNode.appendChild(ObjNewEquipNode)

    XDocument.submit

    XDocument.View.SwitchView("View 1")

    End Sub

    Filed under: ,
  • 06-11-2009 03:10 AM In reply to

    Re: Namespace prefix not declare

    Hi,

    Change your namespace declaration like this.

    XDocument.DOM.setProperty "SelectionNamespaces",
    "xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/ado/dataFields""
    xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-13T09:33:48"""

    Hope this helps.

    Rajitha
  • 04-19-2010 12:48 AM In reply to

    Re: Namespace prefix not declare

    Hi All,
     
    I am not able to access Infopath 2010 control from .Net project ..
     
    i am able to associate the .net project with Infopath, and able to write some code in following delegates ..
     
    public void InternalStartup()

    {

    ((
    ButtonEvent)EventManager.ControlEvents["btnNext0"]).Clicked += new ClickedEventHandler(btnNext0_Clicked);

     

    EventManager.XmlEvents["/my:myFields/my:ddlstRegion"].Changing += new XmlChangingEventHandler(ddlstRegion_Changing);

    EventManager.XmlEvents[

    "/my:myFields/my:rbtnHaveXCode"].Changing += new XmlChangingEventHandler(rbtnHaveXCode_Changing);

    }

     
    but my requirement is to change some of the controls value at tuntime, so i am need to access those control at run time.
     
    at google i have gone through few example ...which says
    Xdocument.DOM.selectSingleNode("dfs:myFields/dfs:dataFields/d:tbl_GC100/@Lockbox").Text = "some text value"
     
    But i am not able to find the assembly for Xdocument.DOM.selectSingleNode
     
    the one i got System.Xml.Linq.Xdocument which does not have the DOM property in it... so can any one pleasae tell me whcih is the assembly i need to refer ...or whats going wrong ?
     
    Thanks
    Arindam
     
    Arindam Chakraborty
  • 04-19-2010 01:38 AM In reply to

    Re: Namespace prefix not declare

    Xdocument.DOM.selectSingleNode()

    was used in InfoPath 2003, to select nodes

    In InfoPath2007 and onwards below is used

    this.CreateNavigator().SelectSingleNode("XPath of the field", this.NamespaceManager).Value

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-19-2010 06:13 AM In reply to

    Re: Namespace prefix not declare

     In C#, it would be thisXDocument, which is an object in your code, not a class.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.