in reply to Strip XML document
It's not clear what output you expect.
Something like this?
for my $tu ($dom->findnodes('/tmx/body/tu')) { for my $child ($tu->findnodes('*')) { ( my $text = $child->textContent ) =~ s,\n, <lb/> ,g; print $text, "\t"; } print "\n"; } __END__ no no Hello <lb/> world! Bonjour <lb/> m +onde yes no no Hello <lb/> world! Bonjour <lb/> monde
Or do you want a table of all the prop types?
</c>use feature qw{ say }; use List::Util qw{ uniq }; my @headers = sort +uniq(map $_->value, $dom->findnodes('/tmx/body/tu/prop/@type' +)); for my $tu ($dom->findnodes('/tmx/body/tu')) { my %props; for my $prop ($tu->findnodes('prop')) { $props{ $prop->findvalue('@type') } = $prop->textContent; } print join("\t", map $_ // "", @props{@headers}), "\t"; for my $child ($tu->findnodes('tuv')) { ( my $text = $child->textContent ) =~ s,\n, <lb/> ,g; print $text, "\t"; } print "\n"; } __END__ aligned client corrected domain project subject no no Hello <lb/> world! Bonjour <lb/> monde + no no yes Hello <lb/> world! Bonjour <lb/> mo +nde
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Strip XML document
by corfuitl (Sexton) on Jul 11, 2018 at 13:33 UTC | |
Re^2: Strip XML document
by corfuitl (Sexton) on Dec 18, 2018 at 12:19 UTC | |
by poj (Abbot) on Dec 18, 2018 at 16:42 UTC | |
by corfuitl (Sexton) on Dec 19, 2018 at 13:20 UTC | |
by poj (Abbot) on Dec 19, 2018 at 13:40 UTC | |
by corfuitl (Sexton) on Dec 19, 2018 at 18:18 UTC | |
by corfuitl (Sexton) on Dec 19, 2018 at 16:12 UTC | |
by poj (Abbot) on Dec 19, 2018 at 17:22 UTC |
In Section
Seekers of Perl Wisdom