我做错了什么?它给了我错误
[Xerces-J 2.9.1]检查“Task3.xml”的格式良好... Ln 8 Col 24 - 对于与元素类型相关联的属性,需要打开引号。 1错误
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<customer customnumber=1 xsi:schemaLocation="Task3.xsd">
<name>Jack Smith</name>
<email>jacksmith@123456.com</email>
<order ordernumber=1>
<orderdate>01-JAN-2016</orderdate>
<handling-cost>100</handling-cost>
<product productnumber=1>
<name>computer</name>
<price>1000</price>
</product>
<product productnumber=2>
<name>piano</name>
<price>100000</price>
</product>
</order>
<order ordernumber=2>
<orderdate>03-JUN-2016</orderdate>
<handling-cost>1000</handling-cost>
<product productnumber=2>
<name>piano</name>
<price>20000</price>
</product>
<product productnumber=4>
<name>viollin</name>
<price>10000</price>
</product>
</order>
</customer>
请帮我改正一下。我应该改变或改变什么?
答案 0 :(得分:2)
XML属性需要用引号括起来:
<order ordernumber="2">
或
<order ordernumber='2'>
您还使用了未声明的命名空间前缀。你需要声明它:
<customer customnumber="1" xsi:schemaLocation="Task3.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">