in reply to Re: Ignore elements using twig module
in thread Ignore elements using twig module

It seems that ignore() method is what i'm seeking to stop and delete current <data> twig.

I'm going to try it in my script and i'll come back as soon as i've results.

GrandFather, your sample could be handy but i think in that specific case doesn't help me because i need to stop and purge current twig if type element is matched.

To become more clear i add a better sample. My xml file has thousands of <container> elements with thousands of text elements to extract and import to one database. My ideia is to "twig" all <container> elements, but to speed up i need to exclude containers that match some kind of types. Just to be more dificult, <container> elements can be nested.

<container> <attribute> <type>xxx</type> </attribute> <data> <var1>a</var1> <var2>b</var2> </data> </container> <container> <attribute> <type>yyy</type> </attribute> <variables> <var1>a</var1> <var2>b</var2> </variables> </container>

Replies are listed 'Best First'.
Re^3: Ignore elements using twig module
by basalto (Beadle) on Mar 02, 2008 at 00:32 UTC
    Hi,

    Sorry the delay, but i don't have too much time to spend coding. This is not my job and I'm doing this just to get some skills about processing XML data.

    Concerning my initial question, I can say that after i apply ignore() method on my program, processing time had a huge reduction as expected. Parsing time drops 33% when input file has 270 MB (initial code takes 9m24s and now takes only 6m16s).

    Thank you for your support.

    Ricardo