[XML-SIG] Stripping a namespace

Uche Ogbuji uche.ogbuji@fourthought.com
Wed, 19 Jun 2002 08:51:07 -0600


> Thanks again for the replies to my earlier question about a deep copy
> of an element into another document.
> 
> I have another complication with this operation.  The element that I
> am copying has an xmlns attribute defined and this is propagated when I
> copy the children.  In the new document I end up with
> 
> <i xmlns='http://purl.org/dc/elements/1.1/'>S</i>
> 
> and I want only
> 
> <i>S</i>
> 
> I'm not sure of the terminology but I think this is a result of the original
> document defining a default namespace in the enclosing element.  I am
> copying the description element from a "Dublin Core" element like

Pretty much inevitable.  The element you copied has a namespaceURI property 
set to xmlns='http://purl.org/dc/elements/1.1/ and a prefix set to None.  This 
causes the re-serialization you're seeing.

I'm not sure what you're greater aim is, but it sounds as if you want to 
change these properties to eliminate the namespace.  I think in many places 
this is an ugly approach.  Perhaps you just want to create a new element on 
the new document which happens to have the same localname as the one in the 
original document, but none of its other properties.


-- 
Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
Track chair, XML/Web Services One (San Jose, Boston): 
http://www.xmlconference.com/
DAML Reference - http://www.xml.com/pub/a/2002/05/01/damlref.html
The Languages of the Semantic Web - http://www.newarchitectmag.com/documents/s=
2453/new1020218556549/index.html
XML, The Model Driven Architecture, and RDF @ XML Europe - 
http://www.xmleurope.com/2002/kttrack.asp#themodel