Changeset 1859

Show
Ignore:
Timestamp:
11/25/06 19:12:51
Author:
miyagawa
Message:

From nikc --

Using extract_xpath I've discovered that it doesn't handle (at least)
text() nodes and attribute values.

For example, give this:

<h1>Some text with <em>extra markup</em></h1>

and just wanting the text, the XPath

extract_xpath:

title: //h1/descendant
text()

fails. Or this:

<meta name="DC.date.modified" content="2006-05-16 15:34:30">

and trying to extract the date:

extract_xpath:

date: //meta[@name="DC.date.modified"]/@content

This is because it always calls the as_XML() method on the extracted
data, and neither of those types support that method.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Filter/EntryFullText.pm

    r1805 r1859  
    276276                no warnings 'redefine'; 
    277277                local *HTML::Element::_xml_escape = \&xml_escape; 
    278                 $data->{$capture} = $children[0]->as_XML; 
     278                $data->{$capture} = $children[0]->isElementNode 
     279                    ? $children[0]->as_XML 
     280                    : $children[0]->getValue; 
    279281            } else { 
    280282                Plagger->context->log(error => "Can't find node matching $self->{extract_xpath}->{$capture}");