Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-30-2006, 01:12 PM
Zainebq Zainebq is offline
Novice
Infopath Onversionchange
 
Join Date: Apr 2006
Posts: 1
Zainebq
Default Infopath Onversionchange

Hi. I am working on this Infopath template. I made some changes to the original version, and wanted to reversion the template. In the new template I added an xml node to the schema. But now when I try to open the old files, it gives an error because that node cannot be found in the old version.

I was trying to use the onversionchange procedure as given in msdn website. But it is not working. I thought I might need an XPath, but still doesnt seem to work. When I use an XPath, I need to save the new node to the XDocument and it does not seem to work. Can someone please help me regarding this. I will be REALLY thankful!

The code I currently have is as follows:

Sub XDocument_OnVersionUpgrade(eventObj)
if XDocument.DOM.selectsingleNode("/my:myFIelds/my:field3") is Nothing
then

'->following is setting up the xPath. I need to specify the "my" namespace
Dim oDomNewNode
set oDomNewNode = createobject("msxml2.domdocument.5.0")
oDomNewNode.loadXML XDocument.DOM.xml
oDomNewNode.setProperty "SelectionLanguage", "XPath"


oDomNewNode.setProperty "SelectionNamespaces",
"xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-04-27T17:55:59"""

Dim objItemNode, objItemAddNode, checkNode
set objItemNode =
oDomNewNode.selectSingleNode("/my:myFields").ownerDocument.createElement("field3" )
set objItemAddNode =
XDocument.DOM.selectsingleNode("/my:myFields").ownerDocument.createElement("field3" )


' Add the new <item> element to the XML document as a
' child of the <order> element.
set checkNode = oDomNewNode.selectSingleNode("/my:myFields").appendChild(objItemNode)
checkNode.text = "this is field3"

'--->Here i was trying to save to the XDocument. But its wrong
'oDomNewNode.save(xDocument.DOM.xml)
end if
end sub
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
InfoPath 2003 on XP machine BarryG Misc 0 11-13-2008 11:03 PM
Infopath Onversionchange Infopath ole db intialization Lynsnewt Misc 2 11-16-2005 08:54 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:47 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft