xsi:schemaLocation 元素类型未绑定

xsi:schemaLocation element type not bound

对 xml 很陌生。验证器抛出错误。

完全错误未绑定与元素类型 "mpreader" 关联的属性 "xsi:schemaLocation" 的前缀 "xsi"。

这是 xml

的片段
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<mpreader xmlns="C:\Users\Dallan\Desktop\Mpreader\" xmlns:xs="http://www.w3.org/20one/XMLSchema-instance" 
 xsi:SchemaLocation="C:\Users\Dallan\Desktop\Mpreader\mpreaderschemafinal.xsd"> 

            <firmware>"3.4.16"</firmware>  
            <hardware>"2.3.53"</hardware>
            <sn>"234-1three5"</sn>

还有xsd

的片段
    <?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="C:Users/Dallan/Desktop/Mpreader/" elementFormDefault="qualified" targetNamespace="C:\Users\Dallan\Desktop\Mpreader\">

<xs:element name="mpreader">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
    <xs:element name="firmware" type="xs:string"/>
    <xs:element name="hardware" type="xs:string"/>
    <xs:element name="sn" type="xs:string"/>
    <xs:element name="devices">
        </xs:sequence>
        </xs:complexType>
        </xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

我有一个类似的问题,我有一个自定义 XML 我需要使用 JAXB 进行解析。

为了正确解析,我需要添加 xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 命名空间。

我改变了这个:

<notifications xmlns="http://some/namespace">

对此:

<notifications xmlns="http://some/namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

我认为在您的情况下,您可能需要在缺少的地方添加它们。