Linux SoftwareProgrammingLibrariesXML::SimpleObject 0.53

XML::SimpleObject 0.53


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


XML::SimpleObject is a Perl extension allowing a simple object representation of a parsed XML::Parser tree.

SYNOPSIS

use XML::SimpleObject;

# Construct with the key/value pairs as argument; this will create its
# own XML::Parser object.
my $xmlobj = new XML::SimpleObject(XML => $XML, ErrorContext => 2);

# ... or construct with the parsed tree as the only argument, having to
# create the XML::Parser object separately.
my $parser = new XML::Parser (ErrorContext => 2, Style => "Tree");
my $xmlobj = new XML::SimpleObject ($parser->parse($XML));

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

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

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

This is a short and simple class allowing simple object access to a parsed XML::Parser 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. See XML::SimpleObject::LibXML for the same interface for XML::LibXML.

USAGE

$xmlobj = new XML::SimpleObject($parser->parse($XML))

$parser is an XML::Parser object created with Style "Tree":

my $parser = new XML::Parser (ErrorContext => 2, Style => "Tree");
After creating $xmlobj, this object can now be used to browse the XML tree with the following methods.

$xmlobj->child('NAME')

This will return a new XML::SimpleObject object using the child element NAME.

$xmlobj->children('NAME')

Called with an argument NAME, children() will return an array of XML::SimpleObject objects of element NAME. Thus, if $xmlobj represents the top-level XML element, 'children' will return an array of all elements directly below the top-level that have the element name NAME.

$xmlobj->children

Called without arguments, 'children()' will return an array of XML::SimpleObject s for all children elements of $xmlobj. These are not in the order they occur in the XML document.

$xmlobj->children_names

This will return an array of all the names of child elements for $xmlobj. You can use this to step through all the children of a given element (see EXAMPLES). Each name will occur only once, even if multiple children exist with that name.

$xmlobj->value

If the element represented by $xmlobj contains any PCDATA, this method will return that text data.

$xmlobj->attribute('NAME')

This returns the text for an attribute NAME of the XML element represented by $xmlobj.

$xmlobj->attributes

This returns a hash of key/value pairs for all elements in element $xmlobj.

Requirements:
  • Perl
    tags xml simpleobject  xml parser  will return  new xml  the xml  filesobj children  children will  style tree  xmlobj new  parser object  element name  with the  name xmlobj  

    Download XML::SimpleObject 0.53


     http://mirrors.evolva.ro/CPAN/authors/id/D/DB/DBRIAN/XML-SimpleObject-0.53.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 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

    XML::EasySQL::XMLobj 1.2 (by Robert Hanson)
    XML::EasySQL::XMLobj is a Fork of Robert Hanson's killer XML::EasyOBJ module, which offers Easy XML object navigation.

    SYNOPS

    XML::Parser::EasyTree 0.01 (by Eric Bohlman)
    XML::Parser::EasyTree is an easier tree style for XML::Parser.

    SYNOPSIS

    use XML::Parser;
    use XML::Parser::EasyTree;
    $XM

    XML::DOM::Attr 1.44 (by XML::DOM::Attr Team)
    XML::DOM::Attr is an XML attribute in XML::DOM.

    XML::DOM::Attr extends XML::DOM::Node.

    The Attr nodes built by the XML::DOM::Pa

    XML::Records 0.12 (by Eric Bohlman)
    XML::Records is a Perl module for perlish record-oriented interface to XML.

    SYNOPSIS

    use XML::Records;
    my $p=XML::Records-

    XML::DOM::Element 1.44 (by T.J. Mather)
    XML::DOM::Element is an XML element node in XML::DOM.

    XML::DOM::Element extends XML::DOM::Node.

    By far the vast majority of obj

    XML::DOM 1.44 (by T.J. Mather)
    XML::DOM is a perl module for building DOM Level 1 compliant document structures.

    SYNOPSIS

    use XML::DOM;

    my $parser = new

    XML::Grove 0.46 Alpha (by Ken MacLeod)
    XML::Grove is a Perl module with Perl-style XML objects.

    SYNOPSIS

    use XML::Grove;

    # Basic parsing and grove building
    use

    XML::Parser 2.34 (by Larry Wall)
    XML::Parser is a perl module for parsing XML documents.

    SYNOPSIS

    use XML::Parser;

    $p1 = new XML::Parser(Style => 'Debu


    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