【发布时间】:2020-11-03 07:15:47
【问题描述】:
我是一个完整的 XML 初学者,我正在尝试学习 XML Schema。我有这两个文件:
note.xml
<?xml version="1.0" encoding="UTF-8"?>
<note
xmlns="https://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.w3schools.com/xml note.xsd">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
note.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="https://www.w3schools.com"
xmlns = "https://www.w3schools.com"
elementFormDefault="qualified">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name = "to" type ="xs:string"/>
<xs:element name = "from" type = "xs:string"/>
<xs:element name = "heading" type = "xs:string"/>
<xs:element name = "body" type = "xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
在 note.xml 中出现错误
cvc-elt.1.a: 找不到元素'note'.xml 的声明
在我的根音符元素上。我在这里看到了其他帖子,但是对于更复杂的解决方案,但我是一个完整的初学者并且什么都不懂。如果您能指导我解决此错误,我将不胜感激。
【问题讨论】:
标签: xml xsd xsd-validation xml-validation