XML Schema问题,找不到元素的声明

时间:2013-11-01 18:07:35

标签: xml xsd

我遇到了xsd的问题,这是由第三方为他们的api提供给我的。我收到的消息是:找不到元素'Message'的声明

以下是我要求的前几行:

<?xml version="1.0" encoding="UTF-8"?>
    <Message xmlns="http://www.surescripts.com/messaging" version="010" release="006" xmlns:xsi="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://aabrahams.staging.skycareehr.com/surescripts.xsd">
        <Header>
            --- more ---

这是xsd:

的开头
<?xml version="1.0" encoding="utf-8"?>
    <xs:schema xmlns="http://www.surescripts.com/messaging" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.surescripts.com/messaging" elementFormDefault="qualified">
        <xs:element name="Message" type="MessageType"/>
            <xs:complexType name="MessageType">
                <xs:sequence>
                    <xs:element name="Header" type="HeaderType"/>
                        <xs:element name="Body" type="BodyType"/>
                    </xs:sequence>
                    --- More ---

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

(1) XSD given by the xsi:schemaLocation attribute格式不正确:在第1831行,关闭标记/xs:element>缺少<个字符。修复它,或在本地复制并修复。

(2)在XML文件中,更改:

xmlns:xsi="http://www.w3.org/2001/XMLSchema"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

(3)同样在XML文件中,更改:

xsi:schemaLocation="http://aabrahams.staging.skycareehr.com/surescripts.xsd"

xsi:schemaLocation="http://www.surescripts.com/messaging surescripts.xsd"

(或者,如果您能够直接修复http://aabrahams.staging.skycareehr.com/surescripts.xsd,可以这样做:)

xsi:schemaLocation="http://www.surescripts.com/messaging http://aabrahams.staging.skycareehr.com/surescripts.xsd"

[应该这样做,但如果你有任何问题,请在下方发表评论,我们会解决。]