Tags » Libxml

Nokogiri and the Ruby SAML Toolkit

I ran into a problem today while working with the Ruby SAMLToolkit, an open source project by the OneLogin Identity Provider. This toolkit offers a relatively easy way to implement… 444 more words


Fixing Nokogiri Warning After Ubuntu Upgrade

I develop Ruby On Rails projects in Ubuntu-based virtual machines.
A few days ago, Canonical released Ubuntu 13.04.
After upgrading to this new release, I got the following warning when running my rails test suite: 174 more words

Using Catalogs for Validation with PHP's DOMDocument and Libxml2

DOMDocument schema and DTD validation in PHP can make use of libxml2’s Catalog support feature.

A catalog is basically a XML file which contains information where to obtain the… 550 more words


Example: How To Parse XML Files With Ruby LibXML

I’ve spent the last two days trying to figure out how to parse XML files using Ruby LibXML. I got to the part where the XML file is parsed, but I couldn’t figure out how to properly get to the “node” after getting the XPath Object. 439 more words


Internship Cloud renderer: Linking problem of libxml2

it’s tricky that you should -Ixml2 at the end, instead of -Ilibxml2…

reference is here

Coding Stuff

Extract links using LibXML

Here’s a little example of the usage of perl’s XML::LibXML to extract links from a HTML page.

use strict;
use warnings;
use LWP::Simple;
use XML::LibXML;

my $url = "http://fantasyfilmfest.com/pages/filme.html";
my $fw = "http://www.freshwap.com/index.php?do=search&subaction=search&full_search=1&catlist[]=5&titleonly=3&story=";

my $p = XML::LibXML->new();
my %opts = (
    suppress_errors => 1,
    recover => 1,
my $dom = $p->parse_html_file($url, \%opts);
my $root = $dom->getDocumentElement;
my $title;
my $info;

foreach my $node ($root->findnodes("//div[\@class='FilmREITER']")) {
    $title = $node->findvalue('a');
    if ($title =~ m/, the/i) {
        $title =~ s/(.*), the/the $1/i;
    print $title . 45 more words