You could use XPath expressions to determine when to prune the tree while
parsing is occurring.

SAXReader reader = new SAXReader();
reader.setDefaultHandler(
    new ElementHandler() {
        public void onStart(ElementPath path) {
        }
        public void onEnd(ElementPath path) {
            Element element = path.getCurrent();

            // process this element if its one I need.

            // do I need to prune this element?
            if (someXPath.matches(element)) {
                element.detach();
            }
        }
    }
);

James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 15, 2002 2:51 PM
Subject: [dom4j-user] Help with XPath and big xml files


> Does anyone can give me any suggestion about this topic?
> The problem is that I've a big xml file (128mb) and I've to
> finds some Xpath iterating through it. I'm doing it with dom...
> an it works only on a pc with 1GB of ram! the other says
> out of memory error. But as I may have to handle also bigger files,
> I was searching for a better solution. I noticed that j4dom
> as an handler in SAXReader and I was thinking I may use that in
> someway... do you have any clue about
> that?!
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


-------------------------------------------------------
This sf.net emial is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0002en
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to