Ignoring your attempts at using an XML parser as an XML generator, one is left with:

# XML::Smart print $sXML->{book}[3]{title}; # XML::LibXML print $root->find('book[4]/title');
# XML::Smart my @books = $sXML->{book}('@'); # XML::LibXML my @books = $root->findnodes('book');

So XML::LibXML is a little bit wordier, but there's a good reason for that. XML::Smart chose to sacrifice some critical functionality to offer its interface.

Either of the first three would make XML::Smart incapable of dealing with the most commonly used XML format (XHTML). The second means it's incapable of handling just about every XML format out there.

Update: Simplified an XML::Smart example that wasn't optimal.
Update: Added third and fourth bullet.


In reply to Re: XML::LibXML - WHAR HASH TREES WHAR?! by ikegami
in thread XML::LibXML - WHAR HASH TREES WHAR?! by SineSwiper

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.