Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Bonjour tous,
J'ai besoin d'aide avec le module XML::Twig: les documents XML que je
veux analyser sont tr=E8s grands et leur traitement l'aide de
XML::Twig est prouv=E9 tr=E8s lent. J'aimerais utiliser 'twig_roots' ou
'twig_handlers' afin de choisir juste quelques parties des documents
Les parties que j'aimerais choisir sont desl=E9ments qui ont des
attributs avec une certaine valeur. La valeur que je cherche change
pendant le traitement du document; il peut arriver par ex. que je
cherche, au d=E9but, l'=E9l=E9ment avec id=3D3, ensuite l'=E9l=E9ment avec
id=3D45 du m=EAme document etc.
Je voudrais donc savoir si je pourrais utiliser une variable dans la
condition concernant la valeur de l'attribut(peut-=EAtre dans une
expressions reguli=E8re?).

par ex. au lieu d'utiliser la cha=EEne de caract=E8res "BLA", utiliser
"$bla" ou /$bla/.
my $twig = XML::Twig->new( twig_handlers => {'attribute[@value=3D"BLA"]'
=3D> \&fonction } );

Je l'ai essay=E9 maisa n'a pas march=E9... Je vous remercie par avance
pour votre aide.

Re: XML::Twig (attempted English translation)

marie wrote:

Quoted text here. Click to load it

Bad translation, with translator's note numbers in square brackets
referring to the bottom of the translation.

Good day to all:

I have need of help with the XML::Twig module: the XML documents which I
must analyze are very large and their handling with the help of
XML::Twig has proven very slow [1]. I would like to use 'twig_roots' or
'twig_handlers' after [2] choosing just some parts of the XML documents.

The parts which I would like to chose are the elements which have
attributes with a certain value. The value for which i search changes
depending on the handling of the document; it can happen [3] (for
example) that I search for, at first, an element with id=3, and then an
element with id=45 in the same document, etc.

For example, ???? [4] to use the string "BLA", using "$bla" or /$bla/.

my $twig = XML::Twig->new (twig_handlers => {'attribute[@value="BLA"]'
=> \&function } );

I have tried but this does not work. I thank you in advance for your help.

Marie (Tom Wyant, translator)

[1] fr 'lent' = en 'slow'? Not sure whether this refers to the
processing speed, or difficulty of coding. TW

[2] fr 'afin' = en 'after'? TW

[3] fr 'arrive' = en 'arrive', but that does not make sense in context.
Maybe 'transpire' rather than 'happen'? TW

[4] fr 'au lieu'. I have no idea what the English is. Sorry. TW

Re: XML::Twig (attempted English translation)

harryfmudd [AT] comcast [DOT] net wrote:
Quoted text here. Click to load it

See the translation by the original poster in the adjacent thread. The
above translation is wrong in at least two important respects:

[2] should have been translated "in order to"

[4] was the heart of the matter. With the untranslated part translated,
the import was that the original poster wanted to specify the desired
string using a variable rather than a literal.

In short, anyone responding should respond to the adjacent thread, not
this one.

The road to Hell is paved with good intentions. Sigh.

Tom Wyant

Re: XML::Twig (attempted English translation)

Thank you all. In fact it was my fault that I didn't write the first
message in English:) I've managed to find the solution to the problem
concerning the use of variables in XML::Twig.
Thanks again!

harryfmudd [AT] comcast [DOT] net acrit :

Quoted text here. Click to load it

Site Timeline