Grep in parts of an XML

M

Mark

Hi,

I want to search for a string in few parts of my XML file. Does anybody
know how can I make a grep for string 'AAA' in the blocks defined as
follows ?

for example:

<function name="f1">
<block><![CDATA[
begin
// printf( AAA + 1);
//junk gavgdwvckgcvkwvckjwfckwfvcsv
printf(AAA);
end;
]]></block>
</function>

Actually, i want to store all the lines between <block></block> tags of
all my functions (in my XML) into a @f_lines list and then 'grep it'
for string AAA. But I have no idea how to get the lines of my functions
into my list.

I didn't yet decide which module to use between XML::LibXML and
XML::Twig. But XML::LibXML seems faster and i think i'll go on it.

TIA for any help.

MA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top