[Mono-devel-list] [Fwd: Re: the patch status followup]

Andrew Skiba andrews at mainsoft.com
Wed Mar 2 05:41:43 EST 2005


Atsushi Eno wrote:
>>I'm investigating this case, and it confuses me a little bit. Code
>>  		XmlElement b = d.CreateElement ("b");
>>		b.SetAttribute ("xmlns","probe");
>>produces element b with namespace "" but with attribute xmlns="probe"
>>How do you make the same thing in XML without DOM? Should not this be
>>treated exactly as
>>		XmlElement b = d.CreateElement ("", "b", "probe");
> I don't get what your question means. Creating XmlElement without
> DOM sounds weird. 

I mean, with DOM API you can create attribute with name xmlns. It looks
that you can not do the same in text form of XML, xmlns will be
interpreted as namespace declaration. It looks pretty strange. Let's
suppose, you declare a _non-default_ namespace with

	b.SetAttribute ("xmlns:a", "probe");

Then this namespace will be treated, naturally, as a namespace. But if
you declare a _default_ namespace, it's not inherited to the children,
so it's not really a namespace declaration. The output of the <b>
element is the same, but the output of children is different. I read DOM
API standard and it says nothing about xmlns special processing. ECMA
does not take into account case with empty prefix and localname="xmlns",
which I also don't understand. The reason I don't understand it is
because in XML when you write

	<b xmlns="probe">

	<b xmlns:a="probe">

the only difference is that the first one declares the default prefix,
and the second declares non-default prefix.

Thank you.
Andrew Skiba.

More information about the Mono-devel-list mailing list