Default-default namespace and localname

M

Max

Hello everyone!

I have 2 questions:
- Is the default-default namespace "http://www.w3.org/2000/xmlns/" or an
empty string("")?
- Is the localname property for element without prefix the name of element
(localName = nodeName) or an empty string("")?

Thanks,

Max
 
M

Martin Honnen

Max wrote:

- Is the default-default namespace "http://www.w3.org/2000/xmlns/" or an
empty string("")?

The namespace with namespace URI http://www.w3.org/2000/xmlns/ is
predefined for xmlns declarations, see
<http://www.w3.org/XML/xml-names-19990114-errata> which says:
"The prefix xmlns is used only to declare namespace bindings and is
by definition bound to the namespace name http://www.w3.org/2000/xmlns/.
It must not be declared. No other prefix may be bound to this namespace
name."

I don't know what "default-default" namespace is supposed to be, if no
default namespace is declared using xmlns="someURI" then elements are in
no namespace if they don't have a prefix in their name.
- Is the localname property for element without prefix the name of element
(localName = nodeName) or an empty string("")?

Well it depends on the object model/standard/implementation but for the
W3C DOM Level 2 Core in a namespace aware implementation the localName
then is the same as the nodeName.
 
J

Joe Kesselman

Max said:
- Is the default-default namespace "http://www.w3.org/2000/xmlns/" or an
empty string("")?

If you do not define a default namespace (or if you undefine the default
namespace by assigning "" to it), the default is "no namespace". (Empty
string is not a legal namespace URI, it's just how XML expresses "no
namespace"). Whether that shows up as empty string or null or something
else depends on which API you're using to access the document's contents.
- Is the localname property for element without prefix the name of element
(localName = nodeName) or an empty string("")?

Per the XML Infoset, if an element is not bound to a namespace it has no
localname. Again, it's up to the API you're using to decide how to tell
you this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,002
Messages
2,570,261
Members
46,859
Latest member
VallieMcKe

Latest Threads

Top