Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • The way namespaces are implemented in XML are not too help full for us humans. An XML parser can keep track of the namespace of a node by checking the prefix used and going up in the DOM until it finds the namespace declaration or if there's no prefix by looking for the closest parent that defines a default namespace.

    For a human this is very error prone, specially if the XML file is generated by a program and that namespaces are redeclared everywhere. This worsens if the namespaces get associated to different prefixes, which is perfectly legal. Trying to match the namespaces manually under such conditions can be quite tedious and error prone. Anyone that has parsed an Excel XML file by hand knows how difficult this can get!

    The thing is that namespaces a vital and can't be avoided. So we have to learn to live with them. They become even more necessary when mixing different XML applications (SVG, XHTML, XSLT, etc).

    This is exactly why I have created Xacobeo [cpan.org]. The main goal was to help me display the XML document and the DOM tree as an XML parser sees it and not as it is declared in the file. For this latter purpose any text editor or pager (less and more) does the job. But,for for seeing the namespaces of the nodes as far as I know nothing existed.

    If you look carefully you will see that Xacobeo always displays each XML node with the proper namespace prefix. No matter if the orignal node used a prefix or if it relied on the default namespace. This makes it trivial to see instantaneously the namespace of each node.