P
Peter Ghali
I'm developing an InfoPath form for a client which allows a user to import
data from another InfoPath xml document. InfoPath's built-in merge function
doesn't meet my needs (I'll spare you the details).
Using managed code, I have an "import" button which invokes a file dialog
that allows the user to select an existing xml doc.
I want my code to query down to a specific repeating section in that
document and append the data to the corresponding section in the user's
current infopath doc.
Here's what I have tried so far:
dim sFilename as string="c:\LastWeeksGroceryList.xml" 'Assume I got this
from a common dialog
dim sourceDoc as new System.Xml.XmlDocument
dim oldList as System.Xml.XmlNode
sourceDoc.Load(sFileName)
dim nsm as New System.Xml.XMLNamespaceManager(sourceDoc.NameTable)
nsm.AddNameSpace("my","http://schemas.mygrocerystore.com/shoppinglist")
oldList=sourceDoc.SelectSingleNode("//my:GroceryList")
'Okay, so what now? oldList returns an object of type
System.Xml.XmlElement, but I can't seem to insert it into my current 'xml
document without getting an "Invalid Cast Exception" Is this even the
correct approach???
I would be very grateful for some help on this...
--Peter
data from another InfoPath xml document. InfoPath's built-in merge function
doesn't meet my needs (I'll spare you the details).
Using managed code, I have an "import" button which invokes a file dialog
that allows the user to select an existing xml doc.
I want my code to query down to a specific repeating section in that
document and append the data to the corresponding section in the user's
current infopath doc.
Here's what I have tried so far:
dim sFilename as string="c:\LastWeeksGroceryList.xml" 'Assume I got this
from a common dialog
dim sourceDoc as new System.Xml.XmlDocument
dim oldList as System.Xml.XmlNode
sourceDoc.Load(sFileName)
dim nsm as New System.Xml.XMLNamespaceManager(sourceDoc.NameTable)
nsm.AddNameSpace("my","http://schemas.mygrocerystore.com/shoppinglist")
oldList=sourceDoc.SelectSingleNode("//my:GroceryList")
'Okay, so what now? oldList returns an object of type
System.Xml.XmlElement, but I can't seem to insert it into my current 'xml
document without getting an "Invalid Cast Exception" Is this even the
correct approach???
I would be very grateful for some help on this...
--Peter