Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / July 2005

Tip: Looking for answers? Try searching our database.

replace dom

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roeland - 20 Jul 2005 15:50 GMT
Hello,

I would like to know how to replace the Dom xml of an InfoPath form in c#.

I have a button in my form. When it is clicked, I deserialized xml to an
object using XmlSerializer. Then I work my objects an I serialize it back to
xml. Now I want to replace the current xml of the InfoPath form, with the new
xml.

I was hoping I could use Dom.LoadXml() method, but i get the error: "This
DOM cannot be loaded twice"

Can anyone help me on this one?
Cheers,
Roeland
Greg Collins [InfoPath MVP] - 20 Jul 2005 17:19 GMT
You will need to use the replaceChild() method... but there are potentially serious performance issues with doing this depending on the design of your form. The entire view will need to be redrawn, event handlers will be called, etc. You might find this to be a great hinderance.

Why are you working on a copy of the DOM instead of the DOM itself (just curious)? Have you looked into using DisableAutoUpdate and EnableAutoUpdate?

Signature

Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com

Hello,

I would like to know how to replace the Dom xml of an InfoPath form in c#.

I have a button in my form. When it is clicked, I deserialized xml to an
object using XmlSerializer. Then I work my objects an I serialize it back to
xml. Now I want to replace the current xml of the InfoPath form, with the new
xml.

I was hoping I could use Dom.LoadXml() method, but i get the error: "This
DOM cannot be loaded twice"

Can anyone help me on this one?
Cheers,
Roeland
Roeland - 20 Jul 2005 21:46 GMT
Greg,

Thanks for you quick response!

I think it is nicer to work with objects than with xmlnodes.
From the schema that I use in InfoPath I generated object in c#.

In my InfoPath form I need to generate some repeating objects.
When I click a button in the form I go to the code(behind) from the form.
I deserialize the xml from the document and I have my objects. Once I have
them I run them through some methods with business intelligents that fill the
collection for the repeating objects.
Once I have done that I serialize those objects back to xml. And that xml
would need to replace the current xml in the dom (thisDocument.Dom.Xml)
I hope I make sense.

I’m going to have a look at “DisableAutoUpdate and EnableAutoUpdate” and
keep you up-to-date.

Thanks again for your help.
Cheers,
Roeland

> You will need to use the replaceChild() method... but there are potentially serious performance issues with doing this depending on the design of your form. The entire view will need to be redrawn, event handlers will be called, etc. You might find this to be a great hinderance.
>
[quoted text clipped - 15 lines]
> Cheers,
> Roeland
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.