将 XSD 文件链接到 XML

Linking an XSD file to XML

我是 XML 的新手,我正在寻找 link 我的 xml 文件的架构,但我使用 http://www.xpathtester.com/validate[=15 收到以下错误=]

错误 - cvc-elt.1:找不到元素 'Courier' 的声明。

.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
    <Courier xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="courier.xsd">
    //Omitted code
    </Courier>

.xsd 文件:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
</xs:schema>

我查看了与此问题相关的各种答案,但我不明白他们答案的哪些部分是必需的。

非常感谢任何帮助。

在您的 xsd 架构中,您没有任何 "Courier" 元素。您需要在 xsd 文件中添加类似 <xs:element name="Courier"> 的内容。