appendchild - InfoPath Dev
in

InfoPath Dev

appendchild

Last post 07-13-2005 02:24 AM by tatopitta. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-05-2005 01:00 AM

    appendchild

    I want to insert a new node Plant, child of Section node. With this code I have an error in the last instruction: "Invalid procedure call or argument"...what's wrong!?!?

    stringXML = "<my:Plant> bla bla bla <\my:Plant>"
    dim objDoc
    set objDoc = CreateObject("Msxml2.DOMDocument.5.0")
    set objDoc = XDocument.CreateDOM()
    objDoc.loadXML(stringXML)
    dim oParentNode
    set oParentNode = XDocument.DOM.selectSingleNode("//my:Section")
    dim Node
    set Node = objDoc.documentElement
    oParentNode.appendChild(Node) ***Error here!***

    Why can instruction "objDoc.loadXML(stringXML)" fail?
    I use appendChild becouse i need to insert the node in a different view. Thank you all!
  • 07-05-2005 10:06 AM In reply to

    Loading the XML fails because you have a back-slash instead of a forward-slash in your closing tag... should be </my:Plant> and not <\my:Plant>.

    appendChild will fail because Node is probably blank due to the loadXML failure.

    Also, I believe you need to set the namespace on objDoc before you append it for it to work correctly.

    Greg Collins [InfoPath MVP]
    InfoPath Dev
  • 07-13-2005 02:24 AM In reply to

    Thanks a lot, you're great!
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.