Title: Message
Presumably the limit is on the size of the serialized document. I doubt there's a reliable way to determine that without performing the serialization. Among the vagaries that you'd have to deal with if you were to track the size of the document as you add to it are character entity representation and text encoding. For instance, a commonly used HTML entity is the non-breaking space, 0xA0. This would be represented as the character entity   in the serialized output, at least with 8-bit encodings. So a single character in the DOM takes 6 bytes to serialize. I think it's possible that it would take 2 bytes in a 16-bit encoding.
 
Maybe you could serialize each node into a throw-away buffer as you add it to the DOM, note how many bytes were written, and compare that plus the bytes written so far to your limit. You'd still have to serialize with each addition, but at least you wouldn't have to serialize the whole document to find out if you just went over the limit. Of course, you'd have to make sure that you use the same encoding for the incremental serializations as you do when you actually serialize the final document.
-----Original Message-----
From: Saraogi, Vikas [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 11, 2004 11:24 AM
To: [EMAIL PROTECTED]
Subject: Size of a DOM document?

Hi y'all,

I am creating a DOM document and adding various elements in it. The DOM document can't exceed a set memory size. Before adding a new element to the document, I need to know the size of the document. If the size exceeds the limit then I will finish that document, serialize it and then start with a new DOM document. How can I find out the size of the DOM Document? I am using Xerces C++ 1.6.0 version.

Thanks for your replies.

Vikas
                                **************************************************************************          The information transmitted herewith is sensitive information intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

Reply via email to