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

Re: Feature suggestion: Hook property on Node

  • To: www-dom@w...
  • Subject: Re: Feature suggestion: Hook property on Node
  • From: Ronald Bourret <rpbourret@r...>
  • Date: Thu, 31 Jan 2002 01:06:36 -0800
  • Cc: xml-dev <xml-dev@l...>
  • References: <3C57A4E7.99535380@r...> <3C580DF5.8E6DE496@w...>

domdataobject
Philippe Le Hegaret wrote:

> > It would be nice if the Node interface had a "hook" property -- that is,
> > a read/write property in which the user could store any value they like.
> 
> Check the DOM Level 3 Core draft:
> http://www.w3.org/TR/2002/WD-DOM-Level-3-Core-20020114/core.html#Node3-setUserData
> 
> The intent is to address the "hook" property as well as memory management
> associated with it and multi-threading environment.
> 
> Feedback is welcome.

That does exactly what I need. (My code wouldn't use the UserDataHandler
interface, but it's easy to imagine code that would.) My only objection
is the name "DOMKeyObject", which sounds like a key, not data.
"DOMDataObject" or "DOMUserDataObject" would be better.

> > Another use (inspired by recent discussions on xml-dev) would be storing
> > the current namespace scoping information. I am certain that many other
> > uses/abuses could be found as well.
> 
> As a side comment, the DOM Level 3 XPath gives you this information:
> http://www.w3.org/TR/2001/WD-DOM-Level-3-XPath-20011031/xpath.html#XPathNamespace
> 
> We didn't find any interest or enough use cases to add this Node into
> the DOM Level 3 Core module. XPath was our only main one.

Too bad. This would be useful for anyone traversing the tree and wanting
to discover what namespace declarations are in force at the time. Two
use cases are:

1) Figuring out if you need to add an xmlns attribute after moving a
node from one location to another. (I would prefer that DOM did this for
you, but in the absence of that, this node would be very useful. The
alternative is to traverse the path back to the root and figure it out
myself. Yech.)

2) Resolving QNames in attribute or element content. I'm not sure how
many languages do this, but at least some do.

Note that it would be most useful if, instead of having a set of
Namespace Nodes, I could simply call Node.getPrefix(uri) and
Node.getURI(prefix).

-- 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.