[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] RE: Namespace use cases
- From: Sean McGrath <sean.mcgrath@propylon.com>
- To: xml-dev@lists.xml.org
- Date: Sat, 11 Jul 2009 10:08:01 -0500
On Jul 9, 2009, at 5:59 PM, Jim Tivy wrote:
>I would love to hear of some success or horror stories of
multi-namespaces
>in authoring content. Anyone out there doing this in DITA, DocBook, open
>office...
I have nothing but horror stories about namespaces in authoring contexts and
in content transformation.
Look at the complexity of XML canonicalization and you will see
the problems that namespaces have wrought. Does serializing a
data structure so that the output is "the same" as the input really have
to be
that complicated?
Look at the complexity of cutting and pasting lumps of XML tree
structures with DOM or any other
XML DAG object model. Look at all the problems that namespace
"bleed"/inheritance causes. Does
programmatic copy/paste really have to be that complicated?
Look at the complexity added to XPath/XQuery to deal with the fact that
new namespace contexts can
come into existence anywhere in the DAG?
Look at the complexity added to tooling like Xerces/Xalan that has to
deal with the fact that new
namespace contexts can come into existence anywhere and at any time?
(http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6344064)
I took a shot at identifying the problems and specifying subsets of
XML's core bits years ago to address
the practical gotchas I was seeing using XML extensively in the real
world. I developed them
for the Irish Government. See http://oreilly.com/pub/wlg/6659. They used
to be online but don't seem to
be online any more however.
Anyway, I have a trick I use every day for namespaced XML processing and
I strongly recommend it
to everyone : mask them.
Start your processing pipelines by masking the namespaces. E.g.
transform this:
<h:table xmlns:h="http://www.w3.org/TR/html4/">
to this:
<h_table xmlns_h="http://www.w3.org/TR/html4/">
Now, go about your business processing the data and when you are ready
to re-serialize to disk, do the transform in reverse. E.g.
transform this:
<h_table xmlns_h="http://www.w3.org/TR/html4/">
to this:
<h:table xmlns:h="http://www.w3.org/TR/html4/">
Obviously, I don't do it prefix by prefix. I use utilities that
transform all prefixes and all namespace
declarations.
It works a treat:-)
Sean
http://seanmcgrath.blogspot.com
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]