Regards, I'm got some issues with this little script:
#!/usr/bin/perl use XML::LibXML; use strict; my $file = $ARGV[0]; my $parser = XML::LibXML->new; my $dom = $parser->parse_file($file) or die; sub getInside{ my $node = shift; if ($node->nodeType == 1){ getInside($node->getFirstChild); } if ($node->nodeType == 3){ print "<p>" . $node->data ."</p>\n" ; } } my @titles = $dom->getElementsByTagName("ParagraphStyleRange"); foreach my $node (@titles){ if ($node->getAttributeNode("AppliedParagraphStyle")->getValue =~ +/BODY TEXT/){ getInside($node); } }
to get the text in Content tag from this xml:
<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/BODY TEXT S +/S"> <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No + character style]" Tracking="-10"> <Content>some text in this container.</Content> <Br/> </CharacterStyleRange> <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No cha +racter style]" Tracking="-10"> <Content>this is not to be printed</Content> <Br/> </CharacterStyleRange> </ParagraphStyleRange>
any pointers will be appreciated here, tx
In reply to missperception of XML::LibXML by ada4u
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |