Nodes - InfoPath Dev
in

InfoPath Dev

Nodes

Last post 07-06-2005 12:37 AM by tatopitta. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-05-2005 08:25 AM

    Nodes

    Which is the simplest way to insert an XML node in a different view?
    ExcuteAction?AppendChild?
  • 07-05-2005 10:02 AM In reply to

    ExecuteAction only works on fields physically present in the current view.

    AppendChild works directly on the XML and will work regardless of whether the fields are present in the current view.

    Which is more simple? Depends on your comfort level with each...

    Greg Collins [InfoPath MVP]
    InfoPath Dev
  • 07-06-2005 12:37 AM In reply to

    Hi, I tried with AppendChild in this way:

    dim objDoc
    set objDoc = CreateObject("Msxml2.DOMDocument.5.0")
    objDoc.setProperty "SelectionNamespaces", "xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"" " & "xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-06-29T14:42:29"" "

    stringXML="<my:Plant> .... </my:Plant>"

    objDoc.loadXML(stringXML)
    objDoc.async = false

    dim oParentNode
    set oParentNode = XDocument.DOM.selectSingleNode("//my:Sezione1")

    dim Node
    set Node = objDoc.selectSingleNode("//my:Plant")
    oParentNode.appendChild(Node)



    but Infopath can't load stringXML becouse of "Reference to an undeclered namespace 'my'"; so I tried to change stringXML:

    stringXML="<my:Plant xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-06-29T14:42:29> .... </my:Plant>"

    But this time there's another error:
    "Element 'http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-06-29T14:42:29}Plant' is unexpected according to content model of parent element 'http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-06-29T14:42:29}Sezione1'."

    How can I make this code work!? :)))
    Thank you all!


Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.