On Thursday 19 July 2007, Joshua Santelli wrote:
> --- "Thomas, Mark - BLS CTR"
<Thomas.Mark bls.gov>
>
> wrote:
> > > 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 "$namen";
> > }
> >
> > - Mark.
>
> I've used nodeType() with childNodes() in the past but
> I can't find the list of (numeric) node types right
> now.
There are constants predefined for the node types in
XML::LibXML::Common.
By default, XML::LibXML exports libxml-style contsants, that
are of the form
XML_*_NODE, where * is ELEMENT, ATTRIBUTE, TEXT, COMMENT,
PI, DOCUMENT, etc.
This is rather badly documented, I admit.
-- Petr
_______________________________________________
Perl-XML mailing list
Perl-XML listserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
|