xml - SVG 问题 : AttValue: "or ' expected

标签 xml svg

我是第一次研究 SVG 图像,我正在遵循在线指南(链接是意大利语,但如果您感兴趣的话,可以是: https://www.html.it/pag/31776/le-figure-geometriche-principali/ ) 但我有一些问题无法解决。

我尝试在 svg 文件中插入简单的几何形状,但我总是收到此错误消息,即使我一次插入一个形状:

This page contains the following errors: error on line 8 at column 11: AttValue: " or ' expected Below is a rendering of the page up to the first error.

我正在尝试的代码是这样的:

<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//Dtd SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/Dtd/svg11.dtd">

<svg width="800" height="600" viewBox="0 0 800 600" preserveAspectratio="xMinYMin" enable-background="new 0 0 800 600"
     version="1.1" xmlns="http://www.w3.org/2000/svg">

    
    <line x1=”10" y1=”10" x2=”100" y2=”100" style=”stroke:red”/>
    
    <polyline points=”30,30 50,50 90,10" style=”stroke:red;fill:none”/>
    
    <circle cx=”100" cy=”100" r=”50" style=”stroke:red;fill:#ff00ee”/>
    
    <rect x=”10" y=”10" rx=”2" ry=”2" width=”100" height=”50" style=”fill:red”/>
    
    <ellipse cx=”100" cy=”100" rx=”70" ry=”50" style=”fill:red”/
    
             </svg>

哪里错了? 怎么解决?

请记住我才刚刚开始学习,试着像个 child 子一样解释一下XD

非常感谢!

最佳答案

正如评论中已经提到的,您使用了两个单引号 而不是双引号 "

在下面的代码中,单引号被替换为双引号。错误消息不再显示

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" 
    xmlns:xlink="http://www.w3.org/1999/xlink">
<line x1="10" y1="10" x2="00" y2="100" style="stroke:red"/>

<polyline points="30,30 50,50 90,10" style="stroke:red;fill:none"/>

<circle cx="100" cy="100" r="50" style="stroke:red;fill:#ff00ee"/>

<rect x="10" y="10" rx="2" ry="2" width="100" height="50" style="fill:red"/>

<ellipse cx="100" cy="100" rx="70" ry="50" style="fill:red"/>

</svg>

关于xml - SVG 问题 : AttValue: "or ' expected,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64863981/

相关文章:

java - 为什么在文件包含特殊 UTF-8 字符时使用 InputSource 修复 SAX 解析器

sql - 遍历 XML 节点并在 SQL Server 中发送电子邮件

java - 如何从 XML 中提取一个 boolean 字段?

javascript - 使用 svg.js 加载 SVG 文件

javascript - SVG textPath 沿路径正确对齐文本

javascript - 编辑路径剪辑以正确方式填充 svg

javascript - d3 防止文本延伸到 SVG 之外

xml - xsl命名空间问题

java - 在 Java 中使用 XPath 提取 XML 中的节点值

javascript - Svg : iframe can not delete ! 为什么?