Hi!

Hi,

I am new to this mailing list.............
I am working with building a parser and implementing
DOM Level 1 and level 2 methods ............

I am facing some initial difficulties while using name
spaces........

Kindly help me on this...

Basically,these are questions on how to implement the
following functions.(using C++)(and not usage of
existing parser).
setNamedItemNS
setAttributeNS
 An attribute node has the following properties.
 1.Node.nodeName--(qualifiedName which contains
 localName optionally preceded by colon and namespace
 prefix.)
 2.Node.namespaceURI--(namespaceURI)
 3.Node.prefix--(prefix extracted from qualifiedName)
 4.Node.localName--(local name,extracted from
 qualifiedName)
 5.Node.nodeValue--(attibute's value)
 
 Now,in DOM Level 2 specification,it is given that,
 setNamedItemNS adds node using its namespaceURI and
 localName.In the NamedNodeMap,I maintain the key as
 string and value as pointer to attribute node.I want
 to know ,in the name-value pair of map whether the
key
 should be qualifiedName(prefix:localName)  or  we
have
 to concatenate localName,some delimiter(say,colon)
and
 namespaceURI and make it as key.
 In the first case,while implementing
setNamedItemNs,to
 check if a node with that namespaceURI and localName
 is already present in this map,we have to check the
 namespaceURI and localName properties of each
 attribute node in the map(since key is
 qualifiedName,we can't check directly by the key).
 But as said in the second case,if we make the key of
 the NamedNodeMap by concatenating localName,: and
 namespaceURI ,then the properties namespaceURI and
 localName of the argument Node can be concatenated in
 the same way and checked directly whether it matches
 with the key.
 Sameway,if the key of NamedNodeMap is going to be
 qualifiedName,
 in setAttributeNS(namespaceURI,qualifiedName,value)
if
 an attribute with the same localName and namespaceURI
 is already present on the element ,its prefix has to
 be changed to the prefix part of the
qualifiedName,the
 nodeName has to be changed to argument qualifiedName
 and also the prefix part of the key of NamedNodeMap
 has to be changed.Another thing is ,if we have
 qualifiedName as key of namedNodeMap,then it's
 possible for  attribute node entries with the same
 local name and namespaceURI but different prefix to
be
 present in the NamedNodeMap which may be misleading
 because even if the prefix is different ,the
attibutes
 are not unique .(since their localName and
 namespaceURI are same).
 If the key of NamedNodeMap is formed by concatenating
 localName,: and namespaceURI,then in the
 implementation
 of setAttributeNS ,if an attribute with the same
 localName and namepsaceURI is already present on the
 element ,is prefix has to be changed to the prefix
 part of the qualifiedName,its nodeName has to be
 changed to the qualifiedName argument and also its
 value.in this case,we'll not have multiple entries
for
 attributes with different prefix but same localName
 and namespaceURI.
 
 So,please tell me,according to DOM specification what
 should be the key of NamedNodeMap?Is it
 qualifiedName(two-part name containing prefix and
  localName) or two-part name
  containing localName and namespaceURI?

------------------------------------------------------

thanks and regards
anusha


__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

Received on Wednesday, 17 October 2001 01:26:03 UTC