Linux SoftwareProgrammingLibrariesXML::SimpleObject::LibXML 0.60

XML::SimpleObject::LibXML 0.60


XML::SimpleObject::LibXML is a Perl extension allowing a simple(r) object representation of an XML::LibXML DOM object. SYNOPSIS
Developer:   Dan Brian
      more software by author →
Price:  0.00
License:   Perl Artistic License
File size:   7K
Language:   
OS:   
Rating:   0 /5 (0 votes)
Your vote:  
enlarge screenshot


XML::SimpleObject::LibXML is a Perl extension allowing a simple(r) object representation of an XML::LibXML DOM object.

SYNOPSIS

use XML::SimpleObject::LibXML;

# Construct with the key/value pairs as argument; this will create its
# own XML::LibXML object.
my $xmlobj = new XML::SimpleObject::LibXML(XML => $XML);
my $xmlobj = new XML::SimpleObject::LibXML(file => "./listing.xml");
my $xmlobj = new XML::SimpleObject::LibXML(); # empty DOM

# ... or construct with the parsed tree as the only argument, having to
# create the XML::LibXML object separately.
my $parser = new XML::LibXML;
my $dom = $parser->parse_file($file);
my $xmlobj = new XML::SimpleObject::LibXML ($dom);

my $filesobj = $xmlobj->child("files")->child("file");

# read values
$filesobj->name;
$filesobj->value;
$filesobj->attribute("type");

%attributes = $filesobj->attributes;
@children = $filesobj->children;
@some_children = $filesobj->children("some");
@children_names = $filesobj->children_names;

# set values
$filesobj->name("Files"); # set name
$filesobj->value("test"); # set text value
$filesobj->attribute("type", "bin"); # set existing attribute's value

# add/delete nodes
$filesobj->add_child
("owner" => "me"); # add new element
$filesobj->add_attribute
("size" => "4"); # add new attribute
$filesobj->delete; # unbinds node from parent

# document processing
$xmlobj->replace_names_values(xpath => "/files/file[0]/title",
value => "places.txt", name => "newtitle");
$xmlobj->delete_nodes(xpath => "/files/file/size");

# output
$xmlobj->output_xml;
$xmlobj->output_xml_file("./newfile.xml");

This is a short and simple class allowing simple object access to a parsed XML::LibXML tree, with methods for fetching children and attributes in as clean a manner as possible. My apologies for further polluting the XML:: space; this is a small and quick module, with easy and compact usage. Some will rightfully question placing another interface over the DOM methods provided by XML::LibXML, but my experience is that people appreciate the total simplicity provided by this module, despite its limitations. These limitations include a minor loss of speed compared to the DOM, loss of control over node types, and protection (aka lack of knowledge) about the DOM. I encourage those who want more control and understanding over the DOM to study XML::LibXML; this module's source can be instructive, too.

Requirements:
  • Perl
    tags xml libxml  xml simpleobject  simpleobject libxml  new xml  xmlobj new  the dom  filesobj children  this module  filesobj add  delete nodes  add new  files file  output xml  

    Download XML::SimpleObject::LibXML 0.60


     http://mirrors.evolva.ro/CPAN/authors/id/D/DB/DBRIAN/XML-SimpleObject-LibXML-0.60.tar.gz


    Authors software

    XML::SimpleObject 0.53 (by Dan Brian)
    XML::SimpleObject is a Perl extension allowing a simple object representation of a parsed XML::Parser tree.

    SYNOPSIS

    use XML:

    XML::SimpleObject::LibXML 0.60 (by Dan Brian)
    XML::SimpleObject::LibXML is a Perl extension allowing a simple(r) object representation of an XML::LibXML DOM object.

    SYNOPSIS


    Similar software

    XML::SimpleObject::LibXML 0.60 (by Dan Brian)
    XML::SimpleObject::LibXML is a Perl extension allowing a simple(r) object representation of an XML::LibXML DOM object.

    SYNOPSIS

    XML::SimpleObject 0.53 (by Dan Brian)
    XML::SimpleObject is a Perl extension allowing a simple object representation of a parsed XML::Parser tree.

    SYNOPSIS

    use XML:

    Template::Tutorial 2.15 (by Andy Wardley)
    Template::Tutorial are template toolkit tutorials.

    This section includes tutorials on using the Template Toolkit

    MathML::Entities 0.13 (by Jacques Distler)
    MathML::Entities is a Perl module that can convert XHTML+MathML Named Entities to Numeric Character References.

    SYNOPSIS

    use M

    XML::Filter::DOMFilter::LibXML 0.02 (by Petr Pajas)
    XML::Filter::DOMFilter::LibXML is a SAX Filter allowing DOM processing of selected subtrees.

    SYNOPSIS

    use XML::LibXML;
    use

    Template::Plugin::XML::LibXML 1.07 (by Mark Fowler)
    Template::Plugin::XML::LibXML is a XML::LibXML Template Toolkit Plugin.

    SYNOPSIS

    [% USE docroot = XML.LibXML("helloworld.xml

    XML::LibXML::DOM 1.58 (by Matt Sergeant)
    XML::LibXML::DOM is a XML::LibXML DOM Implementation.

    XML::LibXML provides an lightwight interface to modify a node of the documen

    XML::LibXML::Enhanced 0.01 (by Michael Stillwell)

    XML::LibXML::Node 1.61003 (by Matt Sergeant, Christian Glahn and Petr Pajas)
    XML::LibXML::Node is an abstract base class of XML::LibXML nodes.

    SYNOPSIS

    $name = $node->nodeName;
    $node->setNodeName( $n

    XML::Code 0.04 (by Arne Claassen)
    XML::Diff is a Perl module for XML DOM-Tree based Diff & Patch Module.

    SYNOPSIS

    my $diff = XML::Diff->new();

    # to genera


    Other software in this category

    zlib 1.2.3 (by Jean-loup Gailly)
    zlib is designed to be a free, general-purpose, legally unencumbered, lossless data-compression library for use on virtually any comp

    libjpeg v6b (by Independent JPEG Group)
    libjpeg is a library for handling the JPEG (JFIF) image format

    OpenSSL 0.9.7c (by The OpenSSL Project Team)
    The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implement

    libxml2 2.6.27 (by DV)
    Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform), libxml2 library i

    GNU C library 2.4 (by Andreas Jaeger)
    GNU C library (glibc) is one of the most important components of GNU Hurd and most modern Linux distributions.

    GNU C library is us

  •     search


    Featured Software

    jEdit 4.3 pre8
    jEdit is an Open Source text editor written in Java

    Opera 9.02
    Surf the Internet in a safer, faster, and easier way with Opera browser

    GNU Aspell 0.60.4
    GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell


    Subscribe in Rojo
    Google Reader
    Add to My Yahoo!

    Add to My AOL
    Subscribe with Bloglines
    Subscribe in NewsGator Online
    Add 'nixbit linux software' to Newsburst from CNET News.com
    del.icio.us nixbit linux software


    Top tags