[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: what's special in XMLNS attribue .?

  • From: Ronald Bourret <rpbourret@r...>
  • To: xml-dev <xml-dev@l...>
  • Date: Mon, 08 Oct 2001 17:03:49 -0700

xmlns dom
David Brownell wrote:
> 
> It's not clear to me how removing "xmlns" attributes would
> have anything at all to do with renaming.

The original question was:

"I'm trying to remove XMLNS attribue from this XML : 
<path xmlns="http://schemas.xmlsoap.org/rp/"
se:mustUnderstand="1"></path>

By using :
IXMLDOMNamedNodeMapPtr m_NodeMapPtr=m_Obj->Getattributes();
IXMLDOMNodePtr RemovedNode = m_NodeMapPtr->removeNamedItem(L"xmlns");

The removeNamedItem successeded but the the attribute remained."

The next question was, "how can i implement the make all elements and
attributes belong to no namespace". Thus, the question is effectively as
follows:

How do I change this:

   <path xmlns="http://schemas.xmlsoap.org/rp/"   
se:mustUnderstand="1"></path>

to this:

   <path se:mustUnderstand="1"></path>

using the DOM?

In other words, how do I rename an element from
{http://schemas.xmlsoap.org/rp/}path to path with the DOM?

> DOM binds namespace URIs "early" ... which means that the
> name isn't going to change no matter what any "xmlns" attributes
> say.  Move a DOM node to some other part of the tree, and
> the namespace URI doesn't change even if the prefix used in
> its node name is bound to a different URI.

We're in agreement here. That is why I pointed out that the question was
really one of renaming an element/attribute, rather than removing an
xmlns attribute. Since element/attribute names are read-only, the only
way to do this with the DOM is to create a new node and copy all of the
information over by hand.

> Or did someone change DOM to be "late binding" when
> I wasn't looking?

Nope.

> If there's anything in the DOM spec that says "xmlns"
> attributes should get special treatment, I surely don't
> remember it.  Seems like some DOM implementation
> has a conformance bug.

The only possible bug is whether it is correct for
NodeMap.removeNamedItem to succeed when called for an xmlns attribute.
The DOM spec doesn't directly address this case, so it's not clear what
the correct behavior is.

-- Ron

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.