【发布时间】:2010-11-10 15:48:06
【问题描述】:
我需要在 svg 图表中包含链接文本。这就是我所做的
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="138pt" height="188pt" viewBox="0.00 0.00 138.00 188.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:html="http://www.w3.org/1999/xhtml">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 184)">
<g id="node5" class="node"><title>EQ2</title>
<ellipse style="fill:none;stroke:black;" cx="65" cy="-18" rx="29.1851" ry="18"/>
<text text-anchor="middle" x="65" y="-13.9" style="font-family:Times New Roman;font-size:14.00;">foo <html:a href="http://google.com">bar</html:a></text>
</g>
</g>
</svg>
我希望html 和html:a 标记的命名空间能够正确处理条形文本。但我得到的是该栏没有显示。正如答案中所建议的,我可以使用 svg:a 元素,但我不明白为什么我的方法不起作用。我希望浏览器 HTML 渲染器能够启动并处理 DOM 树的那部分。
【问题讨论】:
标签: xml xhtml namespaces svg