Re: Regarding setNamedItem!!!

The www-dom list is more appropriate for questions about the DOM spec,
www-dom-ts is specifically for the effort to write testing suites for the
DOM specifications.

It is unclear whether you are asking usage or implementation questions.
That is whether you are trying to use an existing DOM parser, such as
Xerces-J or MSXML, or whether you are asking how to implement these
functions.

If you haven't read
http://www.w3.org/TR/DOM-Level-2-Core/core.html#Namespaces-Considerations,
you should read it again.

> wanted to know ....What should be the lookup key used to retrieve from
NamedNodeMap? > Is it qualifiedName(two-part name containing prefix and
localName) or two-part name
> containing localName and namespaceURI?

getNamedItem and setNamedItem have no concept of qualified names, like XML
1.0, what looks like a "qualified name" is just a tag name that happens to
contain a colon and colons have no special significance.

If you are manipulating documents that have a declared namespace, you should
be exclusively using the *NS variants.

>When I have both DOM Level 1 and level 2 methods implemented, to implement
a parse
> function which parses an input XML file,what kind of checking  should
> I make to choose an appropriate method from level 1 or level 2 (the one
with namespaces).
> For example, in the input XML FILE, when I encounter an attribute node of
an element, how
> do I know whether setNamedItem or setNamedItemNS should be called?

DOM implementations will typically be able to build a tree from an XML
document (or stream of SAX events) in a manner that both DOM Level 1 calls
and DOM Level 2 calls will behave reasonably.  However, there is no
guarantee that a public user of a DOM implementation can build a tree using
*NS methods and accessing using the non NS methods or vice-versa.

Received on Tuesday, 16 October 2001 02:40:27 UTC