ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved