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: Question about getNodeName
by Bjoern Hoehrmann other posts by this author
Jun 13 2006 2:05PM messages near this date
view in the new Beta List Site
Re: Question about getNodeName | Re: xml::grove fails during make install
& XSLT * Mesdaq, Ali wrote:
> When using DOM and getNodeName I get the name and "#text" returned. Why
> is #text returned and how can I have only the name returned? 
> 
> my $root = $doc->getDocumentElement();
> my @installinfo = $root->getChildNodes();
> foreach my $run (@installinfo)
> {
>         print $run->getNodeName(), "\n";
> }

You iterate over the child nodes. A node can be an element, some text, a
processing instruction, an entity reference, a comment, and so on. So in
your example you hit a text node and the name of a text node is "#text".
If you want to skip text nodes, you can e.g. filter the node type (which
is probably availabe through getNodeType()).
-- 
Björn Höhrmann · mailto:bjoern@[...].de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Ali Mesdaq
Mark - BLS CTR Thomas
Petr Pajas
Bjoern Hoehrmann

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved