473,386 Members | 1,753 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 (XmlSerialization, 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 3593
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 (XmlSerialization, 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_PLEASEtkachenko.com> wrote in message
news:ey*************@TK2MSFTNGP11.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 (XmlSerialization, 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_PLEASEtkachenko.com> wrote in message
news:eb**************@TK2MSFTNGP11.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
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...
4
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...
4
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...
1
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...
10
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...
1
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...
2
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...
1
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" /> ...
3
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:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.