all groups > dotnet xml > march 2005 >
You're in the

dotnet xml

group:

XML serialzation


XML serialzation Stipe
3/26/2005 12:00:00 AM
dotnet xml: Hi!

Because of the size of XML document, I'm trying to skip some elements in
XML for the properties which are not changed during current session. I
am holding those property names in array, and if property is not changed
(it has old value) than I don't want to include it in XML.

I know that I can use transformation, but I'm wondering if there is a
better way to do this.

TIA
Re: XML serialzation Mike Douglas
3/26/2005 2:39:41 PM
How are you serializing your XML?

Using the XmlTextReader and skipping the unchanged elements as you
wank the XML tree would be fast. the reader doesn't try to load the
entire XML document into memory.

What if you kept the list of "changed" elemnts in memory instead of
the unchanged. Then do XPaths to the specific changed elements and
bypass the unchanged ones.

I hope this might give you a couple ideas.

Mike Douglas

On Sat, 26 Mar 2005 01:33:36 +0100, Stipe <spujko@nospoam.vip.hr>
[quoted text, click to view]
Re: XML serialzation Stipe
3/27/2005 2:52:41 PM
I'm not quite sure that we have understand each other... What I am doing
is serializing object with XmlSerializer intto XML document. This works
fine, but I want to remove XML elements (object properties) which are
not changed during process. For example, there is input XML (deserialzed
to object):

<book>
<id>1</id>
<author>Neal Stephenson</author>
<title>Cryptonomicon</title>
<price>28</price>
</book>

If only price was changed during the process, (I'm keeping which
properties are changed) desired XML wold be:

<book>
<id>1</id>
<price>25</price>
</book>

Off course, real situation is a little bit more complex, because there
is lot of elements, some complex types, arrays and so on.

Now I am writing IXmlSerializable interface, but it is not supported
feature, so I'm still looking for a better way :)

Stipe

[quoted text, click to view]
AddThis Social Bookmark Button