Hi All,

For those of you who are interested, I have found a work-around for the 
classical DOM issues and streams in .Net (large DOM after a busy client). The 
solution is obvious if you think about it and I have no idea why I didn't come 
up with it before.

Simply delete the elements from the DOM as you no longer need them! Here is 
some code demonstrating the concept:

void IXmlNotificationTarget.XmlElementStarted(XmlElement element)
        {
            depth++;

            object o = Deserialize(element);

            // Root.
            if (depth == 1)
            {
                if (o != null)
                    target.StanzaOpened(o, depth);
            }
            // Stanza.
            else if (depth == 2)
            {
                if (o != null)
                    target.StanzaOpened(o, depth);
            }
        }

        void IXmlNotificationTarget.XmlElementEnded(XmlElement element)
        {
            object o = Deserialize(element);

            // Root.
            if (depth == 1)
            {
                if (o != null)
                    target.StanzaClosed(o, depth);
            }
            // Stanza.
            else if (depth == 2)
            {
                if (o != null)
                    target.StanzaClosed(o, depth);

                // Remove self.
                element.ParentNode.RemoveChild(element);
                // Completely destroy.
                element.RemoveAll();
            }

            depth--;
        }

HTH

Jonathan
_______________________________________________
JDev mailing list
FAQ: http://www.jabber.org/discussion-lists/jdev-faq
Forum: http://www.jabberforum.org/forumdisplay.php?f=20
Info: http://mail.jabber.org/mailman/listinfo/jdev
Unsubscribe: [EMAIL PROTECTED]
_______________________________________________

Reply via email to