xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent Hardy <vincent.ha...@sun.com>
Subject Re: Loading images in ECMA scripts
Date Fri, 11 Jul 2003 07:11:20 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body>
Hello Kari,<br>
<br>
setAttributeNS takes a qualified name, and the namespace prefix and colon
are optional in a qualified name. So both "href" and "xlink:href" are legal
according to the DOM specification. My point was that "xlink:href" was correct,
not that "href" was incorrect.<br>
<br>
getAttributeNS takes a 'local name' as a second attribute. So for getAttributeNS,
only 'href' is ok. getAttributeNS(xlinkNS, "xlink:href") is not working because
there is no attribute with local name 'xlink:href'.<br>
<br>
So you can do:<br>
<br>
image.setAttributeNS(xlinkNS, "xlink:href", <a class="moz-txt-link-rfc2396E" href="http://whatever">"http://whatever"</a>);<br>
image.setAttributeNS(xlinkNS, "href", <a class="moz-txt-link-rfc2396E" href="http://whatever2">"http://whatever2"</a>);<br>
String href &nbsp;= image.getAttributeNS(xlinkNS, "href");<br>
<br>
as you found out in your experimentations,<br>
Regards,<br>
Vincent.<br>
<br>
Kari Hoijarvi wrote:<br>
<blockquote type="cite"
 cite="midJLEDIDHDFFNLOJICLAALGEMLFFAA.hoijarvi@me.wustl.edu">
  <pre wrap="">Thanks for info. Surprise to me. I have always 
used local names with the second parameter, when 
scripting adobe plugin. 

I just tested this with ASV3, and setting works.
For my surprise, getting does not.

image.setAttributeNS(xlinkNS, "xlink:href", <a class="moz-txt-link-rfc2396E" href="http://whatever">"http://whatever"</a>);

image.getAttributeNS(xlinkNS, "xlink:href") is not there
image.getAttributeNS(xlinkNS, "href") == <a class="moz-txt-link-rfc2396E" href="http://whatever">"http://whatever"</a>;

Yet another bug in ASV3?

I wonder then what's wrong then with the original script. 
In my experience, checking that no parameter is undefined 
has solved a lot of problems. 


Kari

-----Original Message-----
From: Vincent Hardy [<a class="moz-txt-link-freetext" href="mailto:vincent.hardy@sun.com">mailto:vincent.hardy@sun.com</a>]
Sent: 10 July 2003 08:29
To: Batik Users
Subject: Re: Loading images in ECMA scripts


Actually, the second parameter on setAttributeNS takes a qualified name, 
so "xlink:href" is correct for the second attribute. There are examples 
using this syntax in the CVS repository (e.g., 
samples/tests/spec/scripting/use.svg).

Vincent.

Kari Hoijarvi wrote:

  </pre>
  <blockquote type="cite">
    <pre wrap="">Try 

  image.setAttributeNS(xlinkNS, "href", url);

without the "xlink:" in the attribute name. The 
namespace is identified by the namespace URI only.

Kari

-----Original Message-----
From: Jens Heidrich [<a class="moz-txt-link-freetext" href="mailto:heidrich@informatik.uni-kl.de">mailto:heidrich@informatik.uni-kl.de</a>]
Sent: 10 July 2003 04:05
To: <a class="moz-txt-link-abbreviated" href="mailto:batik-users@xml.apache.org">batik-users@xml.apache.org</a>
Subject: Loading images in ECMA scripts


Hello,

we are using SVG in order to display charts, that use JavaScript to 
support some simple interaction. We discovered a strange behavior when 
trying to change the "href" attribute of an image by an ECMA script:

function load_image(url) {
  image = document.getElementById("image");
  image.setAttributeNS(xlinkNS, "xlink:href", url);
}

Our aim was to change the image by clicking on a certain SVG element. 
According to the squiggle DOM Viewer the DOM is adapted accordingly by 
the script (that is, it includes an attribute "xlink:href" and the 
corresponding, transmitted URL), but the displayed image is still the 
same (and shows the image of the old URL). Other attribute changes (like 
size or position) seem to work as expected.

We discovered this while using Batik 1.5 beta4b and beta5. We are 
running Batik under Windows 2000, JDK 1.4.1_01.

Any help will be appreciated.


Regards,

Jens


---------------------------------------------------------------------
To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:batik-users-unsubscribe@xml.apache.org">batik-users-unsubscribe@xml.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:batik-users-help@xml.apache.org">batik-users-help@xml.apache.org</a>



---------------------------------------------------------------------
To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:batik-users-unsubscribe@xml.apache.org">batik-users-unsubscribe@xml.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:batik-users-help@xml.apache.org">batik-users-help@xml.apache.org</a>


 

    </pre>
  </blockquote>
  <pre wrap=""><!---->


---------------------------------------------------------------------
To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:batik-users-unsubscribe@xml.apache.org">batik-users-unsubscribe@xml.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:batik-users-help@xml.apache.org">batik-users-help@xml.apache.org</a>



---------------------------------------------------------------------
To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:batik-users-unsubscribe@xml.apache.org">batik-users-unsubscribe@xml.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:batik-users-help@xml.apache.org">batik-users-help@xml.apache.org</a>


  </pre>
</blockquote>
<br>
</body>
</html>


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message