http://www.perlmonks.org?node_id=947863


in reply to Re^4: Is there any XML reader like this?
in thread Is there any XML reader like this?

The documentation for the Parser is all in one page, not 32. The second error was an XPath error. Fixed. At least they were documented an easy to find. Note that I had as many mistakes in the XML::Simple version first.
  • Comment on Re^5: Is there any XML reader like this?

Replies are listed 'Best First'.
Re^6: Is there any XML reader like this?
by Jenda (Abbot) on Jan 15, 2012 at 00:30 UTC

    Documentation for the parser? Which one is that if I may ask? perldoc XML::LibXML prints something that definitely doesn't fit a single page and ... doesn't tell me anything of use. perldoc XML::LibXML::Parser doesn't fit on a single page either and ... OK, it explains how I turn the XML into a maze of interconnected objects. It says that I can use it to parse not only XML, but also HTML and SGML and god knows what else. It doesn't say anything about what the heck am I supposed to do with the maze of objects. It doesn't even care to tell me what's the $doc all those tons of methods return. Nada, nil, nothing. So back to the XML::LibXML docs ... OK, XML::LibXML::Document looks promising, perldoc XML::LibXML::Document. 43 methods (if I did not loose count somewhere in the muddle). Maybe more because maybe the object inherits methods from some other but ... no info about that in the docs either ... basically looking at the docs seems the only way to get at the data is to call the ->documentElement() and then ... OK, maybe what I get is a XML::LibXML::Element or something. Or maybe I could call ->getElementsByTagName() but ... "Implements the DOM Level 2 function" now what the fsck is that? You call that documentation?

    And XPath? Where's that even just mentioned in the docs? Oh, I see. The start of the description:

    This module is an interface to the gnome libxml2 DOM and SAX parser and the DOM tree. It also provides an XML::XPath-like findnodes() interface, providing access to the XPath API in libxml2.
    So what docs am I supposed to find and read? If anything I just installed a Perl module XML::LibXML, not some, what was it, gnomio&juliet libxml2. And a XML::XPath-like? How much alike? Where do I find the docs? So am I supposed to use XML::XPath instead or what?

    No guys, really, I did look at XML::LibXML a few years ago and tried to learn how to use it, but hey ... I had some work to do, I did not have time to search docs hardly mentioned in these and then other docs and then god only knows what else. Some time later I tried to see what would it take to change XML::Rules to use the universally hailed SAX instead of the good old XML::Parser::Expat, but ... maybe the docs make sense to someone, they did not make any to me.

    For someone who had to learn all that XAnythingYouCanThinkOf and DOM nonsense for other languages, the docs of XML::LibXML may contain all info they need. Or at least enough to get them started. For others it's one of the least helpfull documentation found for a Perl module.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.

      Hi, you might like XML::LibXML - WHAR HASH TREES WHAR?!

      FWIW, when I want to learn a new package, I skip the SYNOPSIS and go straight for the test suite -- its code that actually runs :)

      perldoc XML::LibXML prints something that definitely doesn't fit a single page and

      uh, the Parser is documented in XML::LibXML::Parser.

      And XPath? Where's that even just mentioned in the docs?

      Are you asking where it's documented that XML::LibXML::Node::findnodes takes an XPath, or are you asking where XPaths are documented in XML::LibXML.

      If the former, XML::LibXML::Node.

      If the latter, your argument is ridiculous. XML::LibXML is no more the place to document XPaths than XML::Simple is the place to document references.