加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xml – 错误:未绑定属性“xsi:schemaLocation”的前缀“xsi”

发布时间:2020-12-15 23:58:49 所属栏目:百科 来源:网络整理
导读:我在针对XSD验证 XML时遇到问题.验证器抛出 The prefix “xsi” for attribute “xsi:schemaLocation” associated with an element type “mpreader” is not bound. 这是一个XML剪辑 ?xml version="1.0" encoding="UTF-8" standalone="no"?mpreader xmlns=
我在针对XSD验证 XML时遇到问题.验证器抛出

The prefix “xsi” for attribute “xsi:schemaLocation” associated with an
element type “mpreader” is not bound.

这是一个XML剪辑

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<mpreader xmlns="C:UsersDallanDesktopMpreader" xmlns:xs="http://www.w3.org/20one/XMLSchema-instance" 
 xsi:schemaLocation="C:UsersDallanDesktopMpreadermpreaderschemafinal.xsd"> 
                <firmware>"3.4.16"</firmware>  

                <hardware>"2.3.53"</hardware>  

                <sn>"234-1three5"</sn>

                <devices> 
            </devices>
        </mpreader>

这是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:UsersDallanDesktopMpreader">

<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:complexType>
        <xs:sequence maxOccurs="unbounded">
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
“与元素类型”mpreader“相关联的属性”xsi:schemaLocation“的前缀”xsi“未绑定.”

然后绑定它,亲爱的达兰,亲爱的达兰…

只需添加一个命名空间声明,将前缀xsi绑定到命名空间http://www.w3.org/2001/XMLSchema-instance

(https://en.wikipedia.org/wiki/There%27s_a_Hole_in_My_Bucket)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读