4xx / svg-edit

Automatically exported from code.google.com/p/svg-edit
MIT License
0 stars 0 forks source link

about setSvgString() #1207

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.I want to use setSvgString()to  inert a string into my svgCanvas
2.there is the content of string : 

var icon = '<a xlink:href="http://www.nctu.edu.tw/">'+
'<g>'+
'<path fill="#191919" stroke="#000000" stroke-width="2" 
d="m150.03069,130.07733c-9.94043,0 -17.99835,8.05792 
-17.99835,17.99835c0,9.94373 8.05792,18.00165 17.99835,18.00165c9.94374,0 
18.00165,-8.05792 18.00165,-18.00165c0,-9.94043 -8.05792,-17.99835 
-18.00165,-17.99835zm0,33.84174c-1.91655,0 -3.47388,-1.55347 
-3.47388,-3.47333s1.55347,-3.47717 3.47388,-3.47717c1.91986,0 3.47717,1.55731 
3.47717,3.47717s-1.55731,3.47333-3.47717,3.47333zm0,-9.54327l-9.73279,-8.12604l4
.29785,0l0,-10.86987l10.87317,0l0,10.86987l4.29401,0l-9.73224,8.12604z"/>'+
'<text xml:space="preserve" text-anchor="middle" font-family="serif" 
font-size="24" id="svg_2" y="157" x="203" stroke-linecap="null" 
stroke-linejoin="null" stroke-dasharray="null" stroke-width="0" 
stroke="#000000" fill="#000000">'+
'a link'+'</text>'+'</g>'+'</a>'

3.but setSvgString() can't work with the tag(<a xlink:href="....">)
if i remove <a xlink:href="....">, it can work smoothly.
i don't why....

What is the expected output? What do you see instead?

I expect I call this function, an icon with a hyperlink  will be inserted into 
svg canvas.

In what browser did you experience this problem? (ALL, Firefox, Opera, etc)

all

In what version of SVG-edit does the problem occur? (Latest trunk, 2.5.1,
etc)

my version if SVG-edit is 2.6

Please provide any additional information below.

Original issue reported on code.google.com by lihu2...@gmail.com on 3 May 2014 at 4:45

GoogleCodeExporter commented 9 years ago
The XML nature of SVG expects a namespace to be defined for all non-default 
namespaces such as that of "xlink" (and you need a root SVG element if your 
code doesn't already have one).

If you add the following around it, it should work:

<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg" 
xmlns:svg="http://www.w3.org/2000/svg" 
xmlns:xlink="http://www.w3.org/1999/xlink">
...
</svg>

Please confirm.

Original comment by bret...@gmail.com on 8 May 2014 at 4:33

GoogleCodeExporter commented 9 years ago
Thank you very much^^

It really help me a lot.

Original comment by lihu2...@gmail.com on 11 May 2014 at 11:35