Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter cberendes

    (@cberendes)

    I’ve tried it again with

    Xpath to posts: item

    No custom namespaces specified

    title->post_title
    link->guid
    description -> post_content

    and still “No items in feed” when there should be two.

    I rolled my own in PHP5.4 and got the two elements I expected:

    $html = "";
    $url = "https://feeds.pinboard.in/rss/u:berendes/t:gas_pressure/";
    $xml = simplexml_load_file($url);
    for($i = 0; $i < 3; $i++){
            $title = $xml->item[$i]->title;
            $link = $xml->item[$i]->link;
            $description = $xml->item[$i]->description;
            $html .= "<a href='$link'><h3>$title</h3></a>";
            $html .= "$description";
    }
    echo $html;
    Thread Starter cberendes

    (@cberendes)

    Solved.

    The key thing is that the pinboard feed has a default namespace:
    <rdf:RDF xmlns="https://purl.org/rss/1.0/" ....>
    rather than just named workspaces, as in the other feed, which worked smoothly:
    <rss xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:atom="https://www.w3.org/2005/Atom" version="2.0">

    so the xpath expression for the feed elements is //default:item and
    the field mappings are default:title => post_title, default:link=>guid, and default:description=>post_content

    This works as expected.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Parsing a Pinboard feed’ is closed to new replies.