in reply to Parsing CData nodes with LibXML
#!/usr/bin/perl -- use strict; use warnings; use XML::LibXML; Main(@ARGV); exit(0); sub Main { my $doc = XML::LibXML->load_xml( string => <<'__XML__'); <?xml version="1.0" encoding="UTF-8"?> <root> <child> <![CDATA[ Here's a bunch of fun text that I want to get a substring out of +. ]]> </child> </root> __XML__ for my $nod ( $doc->findnodes('/root/child/text()') ) { print "$nod\n", $nod->string_value, "\n-----\n"; } } ## end sub Main __END__ XML::LibXML::Text=SCALAR(0xa12c14) ----- XML::LibXML::CDATASection=SCALAR(0xa983c4) Here's a bunch of fun text that I want to get a substring out of +. ----- XML::LibXML::Text=SCALAR(0x9d75d4) -----
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing CData nodes with LibXML
by silvertip257 (Initiate) on Apr 07, 2010 at 03:43 UTC | |
by Anonymous Monk on Apr 07, 2010 at 03:52 UTC |