Hi Björn
normally you are right and I wouldn't have to do that. But I want to
export a SVG group with foreign attributes. So I created a new XML file
on the server. A link in my SVG application opens this file in a new
browser window. Unfortunately, the Internet Explorer (version 6) gives
you an error message, that the foreign namespace is not declared (Opera
and Firefox both ignoring this). I don't want to disturb my users with
error messages, therefore I had to fix this problem by inserting a xmlns
for my foreign elements in the group.
Your code
.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:foo', '...');
worked very well.
Thanks
Olaf
Bjoern Hoehrmann wrote:
>
>
> * Olaf Schnabel wrote:
> >I have a problem concerning the generation of xmlns-attributes with
> >Javascript in SVG group nodes.
>
> You never have to do that, unless you mean namespace prefix declarations
> because you need to use the prefixes in content (e.g., attribute values)
> which is a bit unlikely. If you are absolutely perfectly 100% certain
> that you need them, you have to know that these are in the
>
> http://www.w3.org/2000/xmlns/ <http://www.w3.org/2000/xmlns/>
>
> namespace, not in no namespace or any other namespace. So in order to
> create a xmlns:foo="..." attribute you use
>
> .setAttributeNS('http://www.w3.org/2000/xmlns/
> <http://www.w3.org/2000/xmlns/>', 'xmlns:foo', '...');
>
> In the case you almost never see in practise where you need to set a
> default namespace declaration, which then does not affect elements with
> no defined prefix, you use
>
> .setAttributeNS('http://www.w3.org/2000/xmlns/
> <http://www.w3.org/2000/xmlns/>', 'xmlns', '...');
>
> Again, it is virtually impossible that you use some dysfunctional markup
> language in combination with SVG where you need this; there would have
> to be some content whose interpretation depends on the in-scope default
> namespace declaration, and its definition allow the re-definition of
> the namespace in weird ways. Don't even think about doing this if you
> are not 101% certain you absolutely must do it.
>
> This is all defined in http://www.w3.org/TR/DOM-Level-3-Core/
> <http://www.w3.org/TR/DOM-Level-3-Core/> FWIW.
--
Olaf Schnabel
ETH Zurich
Institute of Cartography
CH-8093 Zurich
Switzerland
tel: ++41 44 633 3031
fax: ++41 44 633 1153
e-mail: [EMAIL PROTECTED]
www1: http://www.ika.ethz.ch/schnabel
www2: http://www.e-cartouche.ch
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/