OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Overlapping namespaces (was: Are we ready ...)

[ Lists Home | Date Index | Thread Index ]

> Why would one want to do this? What advantages would it afford? In what
> scenarios would it be useful?

Okay, this is a completely different topic from the last permathread.

Say I want to take some XML formatted content and merge it into an HTML
document. Some of the elements are directly translatable to HTML elements,
but not others. Say I have a <my:body> in my content. I want to present that
as <xhtml:body>. There are other elements in the content that are not
correspondent with HTML elements, even though their names the same. Say for
example, I have a <my:title> element (if Bob DuCharme was reading this he'd
point out that it is a tag, not an element, but you know what I mean; sloppy
is as sloppy does). 

Anyhow, you can write an XSLT script that converts some content to HTML, and
leaves the rest alone. But you've lost information in the conversion. What
if later you want to extract the original XML content from the HTML? Can't
do it, all the namespaces are gone buddy.

Yeah, there are workarounds. You could preserve the content in comments. I
suppose there are better ways, I just don't do document mixing that often,
lucky me.

Still, it seems the simplest way to preserve namespace information is not to
ditch it in the first pass, but preserve in a manner that was close to the
way it was originally presented. So instead over converting <my:body> to
<xhtml:body>, just prepend the xhmtl prefix (and I mean a Namespaces in XML
prefix) to the existent 'my' prefix:

<xhtml:my:body>

What good does this do?  Well the browser can see the xhtml namespace
association, ignore the 'my' namespace association, and do the write thing
with the body content. A process that wants to extract the original content
from the XHTML (say it's soooo far down the line that it doesn't know where
the original content originated from) can do so because the original
namespace association can still be had.

Yet another processor can work magic by knowing that *both* namespaces have
been associated (I wouldn't necessarily say *in*, but perhaps I should) with
the body element. Maybe it wants to extract original content while
preserving format, for instance.

So I'm waiting for somebody knowledgeable to tell me why this is a crappy
idea. I really haven't thought through the horrific consequences that are
sure to follow.











 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS