Re: perl-ish way to deal with footnotes in an XML document
by Birgit Kellner other posts by this author
Jul 19 2007 12:49PM messages near this date
view in the new Beta List Site
Re: perl-ish way to deal with footnotes in an XML document
|
RE: perl-ish way to deal with footnotes in an XML document
& XSLT Thomas, Mark - BLS CTR schrieb:
> > That's good to know. Do you have any suggestions how exactly I might
> > go
> > about it, then?
> >
> > I tried this with XML::LibXML:
> >
> > my $children = $seg->findnodes('child::*');
> > foreach my $child ($children->get_nodelist) {
> > print $child->textContent ;
> > my $name = $child->nodeName;
> > print "$name \n";
> > }
> >
>
> I'm pretty sure * returns only elements, not text nodes. Try this
> instead:
>
> foreach my $child ($seg->childNodes) {
> my $name = $child->nodeName;
> print "$name\n";
> }
>
> - Mark.
>
>
>
That's it!
my $test;
my @children = $seg-> childNodes;
foreach my $child (@children) {
my $name = $child-> nodeName;
if ($name eq "text") { $test .= $child-> textContent ;}
elsif ($name eq "note") { $test .= "NOTECODE";}
}
print $test;
Many thanks for pointing me into the right direction,
Birgit
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Birgit Kellner
Mark - BLS CTR Thomas
Birgit Kellner
Mark - BLS CTR Thomas
A. Pagaltzis
Birgit Kellner
Joshua Santelli
Petr Pajas
|