简体   繁体   English

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

[英]XML Schema issue, cannot find declaration of element

I have a problem with a xsd which was given to me by a third party for their api. 我有一个第三方为他们提供的API给我的xsd问题。 The message i get is: Cannot find the declaration of element 'Message' 我得到的消息是:找不到元素“消息”的声明

Here is the first few lines of my request: 这是我的要求的前几行:

<?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 ---

And here is the beginning of the xsd: 这是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 ---

Any suggestions? 有什么建议么?

(1) The XSD given by the xsi:schemaLocation attribute is not well formed: On line 1831 the close tag, /xs:element> , is missing a < character. (1) xsi:schemaLocation属性给出XSD格式不正确:在第1831行,关闭标签/xs:element>缺少<字符。 Fix it there, or copy it locally and fix. 在此修复,或在本地复制并修复。

(2) In the XML file, change: (2)在XML文件中,更改:

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

to

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

(3) Also in the XML file, change: (3)同样在XML文件中,更改:

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

to

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

(Or, if you were able to fix http://aabrahams.staging.skycareehr.com/surescripts.xsd directly you can make it this:) (或者,如果您能够直接修复http://aabrahams.staging.skycareehr.com/surescripts.xsd ,则可以这样做:)

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

[That should do it, but if you have any more trouble, comment below and we'll address.] [应该这样做,但是如果您还有其他麻烦,请在下面评论,我们将解决。]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM