|
Posted by marie on June 10, 2006, 7:01 pm
Please log in for more thread options
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 a =E9crit :
> harryfmudd [AT] comcast [DOT] net wrote:
> > marie wrote:
> >
> >> Bonjour =E0 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 =E0 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
> >> XML.
> >> Les parties que j'aimerais choisir sont des =E9l=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 =3D XML::Twig->new( twig_handlers =3D> {'attribute[@value=3D"=
BLA"]'
> >> =3D> \&fonction } );
> >>
> >> Je l'ai essay=E9 mais =E7a n'a pas march=E9... Je vous remercie par av=
ance
> >> pour votre aide.
> >>
> >
> > 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=3D3, and then =
an
> > element with id=3D45 in the same document, etc.
> >
> > For example, ???? [4] to use the string "BLA", using "$bla" or /$bla/.
> >
> > my $twig =3D XML::Twig->new (twig_handlers =3D> {'attribute[@value=3D"B=
LA"]'
> > =3D> \&function } );
> >
> > I have tried but this does not work. I thank you in advance for your he=
lp.
> >
> > Marie (Tom Wyant, translator)
> >
> > [1] fr 'lent' =3D en 'slow'? Not sure whether this refers to the
> > processing speed, or difficulty of coding. TW
> >
> > [2] fr 'afin' =3D en 'after'? TW
> >
> > [3] fr 'arrive' =3D en 'arrive', but that does not make sense in contex=
t=2E
> > Maybe 'transpire' rather than 'happen'? TW
> >
> > [4] fr 'au lieu'. I have no idea what the English is. Sorry. TW
>
> 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.
>=20
> Tom Wyant
|