W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2002

Questions about prefix and namespace

From: Luoh Ren-Shan <luors@iii.org.tw>
Date: Wed, 23 Oct 2002 16:32:07 +0800
Message-ID: <005d01c27a6e$ad3d9280$298c5c8c@meow>
To: <www-dom@w3.org>
Hi all,

Is there a function in the DOM spec to get namespace
and prefix information from a given node?
Do I have to write some function like
"getPrefixList", "getNamespaceURIList",
"getNamespaceURI2PrefixMap", etc. ?

I have problem when using the "createElementNS"
function which ask me to give a qualified name.
I have to find which prefix to use (maybe the 
prefix has been defined before).
I have to always write code like
createElementNS("..", myPrefix + ":" + myLocalName)
to concatenate the name.
And when serializing the DOM tree, I have to
add "xmlns:myPrefix=".."" attributes manually
at some appropriate places.

I'm not very familiar with the DOM API.
Could some one tell me a better way to deal with it?

Thank you,
Luoh Ren-Shan
Received on Wednesday, 23 October 2002 04:30:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:56 GMT