I have this Java method trying to change an image in a org.w3c.dom.Document.
Element element = (Element)svgDoc.getElementById("SVGimage");
element.setAttribute("width", "100");
element.setAttribute("xlink:href", filename);
svgCanvas.setDocument(svgDoc);
the corresponding SVG file has this line:
<image id="SVGimage" x="100" y="100" height="200" width="200" xlink:href="VAGUE.svg"/>
The 'width' changes correctly, the image stays idle.
正确的呼叫是:
element.setAttributeNS("w3.org/1999/xlink", "href", filename);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.