in reply to XML::LibXML - WHAR HASH TREES WHAR?!
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.
XML::LibXML supports namespaces. XML::Smart doesn't (except when used to generate documents).
XML::LibXML preserves the order of the children of elements. XML::Smart can't even list the children of an element.
Comments are dropped.
Only can only distinguish distinguish between elements and attributes when using XML::LibXML.
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML::LibXML - WHAR HASH TREES WHAR?!
by SineSwiper (Beadle) on Jul 15, 2011 at 19:18 UTC | |
by ikegami (Patriarch) on Jul 15, 2011 at 19:24 UTC | |
by SineSwiper (Beadle) on Jul 15, 2011 at 19:48 UTC | |
by ikegami (Patriarch) on Jul 15, 2011 at 19:55 UTC | |
by SineSwiper (Beadle) on Jul 15, 2011 at 22:23 UTC | |
|