Tatsuhiko Miyagawa > XML-OPML-LibXML-0.04 > XML::OPML::LibXML

Download:
XML-OPML-LibXML-0.04.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.04   Source  

NAME ^

XML::OPML::LibXML - Parse OPML document with LibXML parser

SYNOPSIS ^

  use XML::OPML::LibXML;

  my $parser = XML::OPML::LibXML->new;
  my $doc    = $parser->parse_file($opml_file);

  # Alternatively, you can create Document object using XML::LibXML::Document
  use XML::LibXML;
  my $dom = XML::LibXML->new->parse_file($opml_file);
  my $doc = XML::OPML::LibXML::Document->new_from_doc($dom);

  # OPML document head properties
  $doc->title;
  $doc->date_created;
  $doc->date_modified;
  $doc->owner_name;

  # XML::OPML::LibXML::Outline
  my @outline = $doc->outline;
  for my $outline (@outline) {
      my $attrs = $attr->attrs;      # hashref
      $outline->title;
      $outline->text;
      if ($outline->is_container) {
          my @outline = $outline->children;
          # do some recursive stuff, see also walkdown()
      } else {
          $outline->type;
          $outline->xml_url;
          $outline->html_url;
      }
  }

  # depth-first walkdown the tree
  $doc->walkdown(\&callback);
  sub callback {
      my $outline = shift;
      # ...
  }

DESCRIPTION ^

XML::OPML::LibXML is an OPML parser written using XML::LibXML. This module is part of spin-off CPANization of Plagger plugins.

For now, all this module does is just parsing an OPML document. The API is very simple and limited to low-level access, yet.

NOTE: This module is not designed to be a drop-in replacement of XML::OPML.

AUTHOR ^

Tatsuhiko Miyagawa <miyagawa@bulknews.net>

LICENSE ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

XML::LibXML, XML::OPML, Plagger

syntax highlighting: