After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 310222 - "du" and "ls" in xmllint shell should show the namespaces
"du" and "ls" in xmllint shell should show the namespaces
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.20
Other Linux
: Normal enhancement
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-07-13 13:27 UTC by Éric Bischoff
Modified: 2012-05-07 09:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Improved namespace support for xmllint shell (5.22 KB, patch)
2012-03-27 13:34 UTC, Ryan
none Details | Review

Description Éric Bischoff 2005-07-13 13:27:25 UTC
$ xmllint --shell content.xml 
/ > setrootns 
/ > ls 
-an        4 document-content 
/ > cd document-content 
document-content is a 0 Node Set 
/ > cd office:document-content 
document-content > 
 
How do I know it was the "office:" namespace without cheating (i.e. look at the 
XML file with an ordinary text editor)? 
 
For comfort in browsing the XML tree, the namespaces should be displayed by 
"ls" and "du" commands. 
 
"cat" displays the namespaces but you get the whole document when you are at 
its root...
Comment 1 Ryan 2012-03-27 13:34:44 UTC
Created attachment 210694 [details] [review]
Improved namespace support for xmllint shell

This patch (against libxml2-2.7.8) adds namespace support to ls, du and the element named in the command shell prompt. It also fixes du to actually dump the requested path, if the user gives one, rather than always dumping the whole file.
Comment 2 Daniel Veillard 2012-05-07 09:06:08 UTC
Patch is interesting but annoyingly it would print ?:foo for foo elements
in the default namespace. In general I would rather show just "foo" though
this would defeat the initial request as pointed by Eric (cd foo will fail
because XPath won't match a node in default namespace that way ...).
In the absence of a general solution to default namespace, I will keep
as is for them, so I modified the patch to only handle namespaces with
explicit prefixes

The patch for du is good too, so picking this up !

http://git.gnome.org/browse/libxml2/commit/?id=40db1eeb3637af933fca491dfc90c25c31e6e05e

  thanks !

Daniel