Error: The prefix "xsd" for element "xsd:schema" is not bound
Error: The prefix "xsd" for element "xsd:schema" is not bound
我对 XML 非常陌生,目前已经准备好使用 Ineasysteps。
我一直从解析器那里得到同样的问题
5:The prefix "xsd" for element "xsd:schema" is not bound.
这是hello.xml:
<?xml version = "1.0" encoding = "UTF-8" ?>
<!-- XML in easy steps - Page 82. -->
<doc xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation = "hello.xsd" >
<msg>Hello World</msg>
</doc>
这是 hello.xsd 文档
<?xml version="1.0" encoding = "UTF-8" ?>
<!-- XML in easy steps - Page 84. -->
<xsd:schema>
<!-- DECLARE ELEMENTS. -->
<!-- Simple types. -->
<xsd:element name="msg" type="xsd:string"/>
<!-- Complex types. -->
<xsd:element name="doc" type="docType"/>
<!-- DEFINE STRUCTURE. -->
<xsd:complexType name="docType">
<xsd:sequence>
<xsd:element ref="msg"/>
</xsd:sequence>
</xsd:complexType
必须在使用前定义名称空间前缀,例如 xsd
。这甚至适用于众所周知的 xsd
(或 xs
)前缀,通常用于 XML 模式(XSD)的组件。
要消除错误,请通过添加
来定义 xsd
命名空间前缀
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
像这样添加到 xsd:schema
根元素:
<?xml version="1.0" encoding = "UTF-8" ?>
<!-- XML in easy steps - Page 84. -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- DECLARE ELEMENTS. -->
<!-- Simple types. -->
<xsd:element name="msg" type="xsd:string"/>
<!-- Complex types. -->
<xsd:element name="doc" type="docType"/>
<!-- DEFINE STRUCTURE. -->
<xsd:complexType name="docType">
<xsd:sequence>
<xsd:element ref="msg"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
我对 XML 非常陌生,目前已经准备好使用 Ineasysteps。 我一直从解析器那里得到同样的问题
5:The prefix "xsd" for element "xsd:schema" is not bound.
这是hello.xml:
<?xml version = "1.0" encoding = "UTF-8" ?>
<!-- XML in easy steps - Page 82. -->
<doc xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation = "hello.xsd" >
<msg>Hello World</msg>
</doc>
这是 hello.xsd 文档
<?xml version="1.0" encoding = "UTF-8" ?>
<!-- XML in easy steps - Page 84. -->
<xsd:schema>
<!-- DECLARE ELEMENTS. -->
<!-- Simple types. -->
<xsd:element name="msg" type="xsd:string"/>
<!-- Complex types. -->
<xsd:element name="doc" type="docType"/>
<!-- DEFINE STRUCTURE. -->
<xsd:complexType name="docType">
<xsd:sequence>
<xsd:element ref="msg"/>
</xsd:sequence>
</xsd:complexType
必须在使用前定义名称空间前缀,例如 xsd
。这甚至适用于众所周知的 xsd
(或 xs
)前缀,通常用于 XML 模式(XSD)的组件。
要消除错误,请通过添加
来定义xsd
命名空间前缀
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
像这样添加到 xsd:schema
根元素:
<?xml version="1.0" encoding = "UTF-8" ?>
<!-- XML in easy steps - Page 84. -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- DECLARE ELEMENTS. -->
<!-- Simple types. -->
<xsd:element name="msg" type="xsd:string"/>
<!-- Complex types. -->
<xsd:element name="doc" type="docType"/>
<!-- DEFINE STRUCTURE. -->
<xsd:complexType name="docType">
<xsd:sequence>
<xsd:element ref="msg"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>