Parsing xml with xml::twig?

Your XML does not conform specification, so no parser could process it as it is. Main problems are.

Your XML does not conform specification, so no parser could process it as it is. Main problems are: XML is case-sensitive, so Item is something else than item closing tags start with slash, not backslash there should be top-level element Fixing those issues, this code works: use strict; use warnings; use XML::Twig; my $data = data1 data2 data1 data2 END_DATA my $t = XML::Twig->new( twig_handlers => { 'item' => sub { # process each item and print contents of dataN elements print $_->first_child_trimmed_text('data1'), "\t", $_->first_child_trimmed_text('data2'),"\n"; }, }, )->parse($data).

Thanks for the answer,sorry I updated my question in the same time you wrote the answer. – Rubin Aug 1 '11 at 19:25 @Rubin - you can access descendant items like this: eval { $_->first_descendant('data3')->trimmed_text }. I think your best bet is to play with example I posted and look XML::Twig docs for methods description.

– bvr Aug 2 '11 at 5:26.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions