473,665 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

save XmlDocument as SQL image data?

I'm still new to Xml, but finding it very useful.

Conceptually what I want to do is compress an XmlDocument, save it to SQL
Server as image data, read it back and restore it to an XmlDocument.

I'm a bit bewildered by the choices available (XmlSerializati on, XmlWriter,
Xml on SQL Server) and do not have any experience with them, so I was
wondering what is the best way to do this?
Nov 11 '05 #1
5 3610
Jack Fox wrote:
I'm still new to Xml, but finding it very useful.

Conceptually what I want to do is compress an XmlDocument, save it to SQL
Server as image data, read it back and restore it to an XmlDocument.

I'm a bit bewildered by the choices available (XmlSerializati on, XmlWriter,
Xml on SQL Server) and do not have any experience with them, so I was
wondering what is the best way to do this?


I believe the best, the simplest and probably the most effective is just
to serialize XmlDocument to string using Save() method. And to resore it
back just load XmlDocument from the string.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2
Thanks, but all of the overloaded Save methods send it to some sort of
writer or file. The OuterXML property should suffice, then use the LoadXml
method to load it.

I thought some sort of easy compression method would be available, my
documents can get quite large.

"Oleg Tkachenko" <oleg@NO_SPAM_P LEASEtkachenko. com> wrote in message
news:ey******** *****@TK2MSFTNG P11.phx.gbl...
Jack Fox wrote:
I'm still new to Xml, but finding it very useful.

Conceptually what I want to do is compress an XmlDocument, save it to SQL Server as image data, read it back and restore it to an XmlDocument.

I'm a bit bewildered by the choices available (XmlSerializati on, XmlWriter, Xml on SQL Server) and do not have any experience with them, so I was
wondering what is the best way to do this?


I believe the best, the simplest and probably the most effective is just
to serialize XmlDocument to string using Save() method. And to resore it
back just load XmlDocument from the string.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #3
Jack Fox wrote:
Thanks, but all of the overloaded Save methods send it to some sort of
writer or file. The OuterXML property should suffice, then use the LoadXml
method to load it. OuterXML, Save, WriteTo, whatever - it's about the same, namely DOM serialization.
I thought some sort of easy compression method would be available, my
documents can get quite large.

If XML is N Mb, then in-memory XmlDocument may be roughly 3N or 4N. Compress
serialized string instead.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #4
I cannot find any Method in the DotNet Framework that does compression,
except related to Passport and encryption of short strings (not megabytes).

Any suggestions?

Even without compression I have greatly enhanced the efficiency (elapsed
time) of my application by saving the OuterXML to SQL Server. The CPU used
for compression and decompression may actually prove detrimental, now that I
think of it. I will eventually have to implement selective cache purging,
but I'm not there yet.
"Oleg Tkachenko" <oleg@NO_SPAM_P LEASEtkachenko. com> wrote in message
news:eb******** ******@TK2MSFTN GP11.phx.gbl...
Jack Fox wrote:
Thanks, but all of the overloaded Save methods send it to some sort of
writer or file. The OuterXML property should suffice, then use the LoadXml method to load it. OuterXML, Save, WriteTo, whatever - it's about the same, namely DOM

serialization.
I thought some sort of easy compression method would be available, my
documents can get quite large. If XML is N Mb, then in-memory XmlDocument may be roughly 3N or 4N.

Compress serialized string instead.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #5
Jack Fox wrote:
I cannot find any Method in the DotNet Framework that does compression,
except related to Passport and encryption of short strings (not megabytes).

Any suggestions?

Google for compression tools for .NET, there are a lot of them. I've used this
one:
http://www.icsharpcode.net/OpenSourc...b/Default.aspx

--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
22606
by: Tom Pearson | last post by:
I have created an XmlDocument and can see that this is correctly formed and has a root element If I Save the doc to a file and reload it all works o If I dump the doc to a stream, again using the Save method, and write this to a file I can then reload this correctly. However since I have no need to write the data to file I want to save it as a stream then reload it the stream. However If I do this I have suddenly lost the root element ...
4
10994
by: Carl Williams | last post by:
Hope someone can help with this... I have looked at all the newsgroup articles and put into practice all the suggestions but to no good. I am pretty new to CSharp and .Net so any help would be greatly appreciated. I have an .ASPX.CS in which I am trying to open an XML file (which already contains content), making some alterations to the XML obtained from the file, and then trying to 'Save' the XML back to the file. I am using a...
4
3709
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml file via some editable controls such as text boxes , option boxes etc. how can i implment this , should i use another xslt file with <INPUT> controls . if so how can i save the result back using the asp.net
1
7731
by: liuhengyi | last post by:
Hi, I have a test program that creates 5 threads and each thread uses XmlDocument.Save(filename) to save a Xml dom to a file. I have put the lock statement around the Save to prevent from concurrently updating. However I'm still seeing "System.IO.IOException: The process cannot access the file "c:\file1.xml" because it is being used by another process." The following is the test program public class XmlTest
10
39481
by: Henok Girma | last post by:
Hello Gurus, I want to save the state of an unbound DataGridView on my Windows Form application to an XML file so i can later load it back.. Basically, on my form I have a DataGridView, it's got some DataGridViewTextBoxCell, DataGridViewComboBoxCell etc, i want to export all that to XML.. Any help is greatly appreciated.
1
6804
by: liuliuliu | last post by:
hi -- sorry if this is trivial -- but how do you make a screenshot of a pygame display? i have a surface which is basically the entire visible screen -- how do you write this surface as an image file during specific events in the script execution? image format doesnt matter. thanks! christine
2
3230
by: =?iso-8859-1?Q?Norbert_P=FCrringer?= | last post by:
Hello there, is it possible to write an XML document into a file, which has a readable structure by using indents? By doubleclicking the xml file, you see a readable XML structure in IE, but if you open the file in a text editor, you get an unformatted structure of the XML. Furthermore I would like to show a formatted XML text in a text box: txtResponse.Text = xDoc.OuterXml
1
1703
by: blintrell | last post by:
<?xml version="1.0" encoding="utf-8"?> <root> <groups> <group gid="1" name="CSM"> <contact cid="1" /> <contact cid="2" /> <contact cid="3" /> <contact cid="4" /> </group> <group gid="2" name="RISIK">
3
3903
by: Stephen Ward | last post by:
I have a simple little project open a xml file change a few nodes save the file, no big deal. The problem is that the doctype is getting modified when I save the file. So it looks like this: <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> But when I save it : <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
0
8438
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4356
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.