|more useful options|
Re^7: Is there any XML reader like this? (XML::Simple beats LibXML hands down in the speed stakes!)by tobyink (Abbot)
|on Jan 16, 2012 at 10:29 UTC||Need Help??|
I really don't see how the documentation for XML::LibXML could be especially difficult to follow for anyone who is vaguely familiar with Perl OO programming. Just follow the usual rule:
If $obj->isa($class) then consult perldoc $class.
The documentation for the parser says that load_xml "the return value [...] is a XML::LibXML::Document object". So you turn to the XML::LibXML::Document documentation.
The method is called documentElement. It's shown in the SYNOPSIS for XML::LibXML::Document, and documented further down in the METHODS section.
getDocumentElement is just an alias for documentElement so is documented much less prominently, so I can understand how that could have been harder to find, but most clients that you'd view documentation in (e.g. browser, "man", "perldoc") allow you to search for strings quite easily.
But anyway, some of your statements on XML::LibXML reveal what I think is a fundamental difference between what you want to do with XML, and what XML::LibXML is designed for.
You just want to get data out of XML and handle it as some sort of native data structure. XML::LibXML is for people who want to keep their data in as XMLish a form as possible (short of loading it into memory as a single XML formatted string and manipulating it with regexps!) - for people who care (not just at loading and saving time) about the difference between:
For people who, given a node $x in some deeply nested data structure, sometimes need to do $x->parentNode.
If you don't need to do that sort of stuff, then perhaps there's a mismatch between your needs and XML::LibXML's aims.
I can tell you that XML::Simple would have been quite useless for something like XML::Atom::OWL.