Dallas Caley
Dallas Caley

Reputation: 5858

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. 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:

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

Upvotes: 1

Views: 1422

Answers (1)

kjhughes
kjhughes

Reputation: 111621

(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. Fix it there, or copy it locally and fix.

(2) In the XML file, change:

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:

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:)

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.]

Upvotes: 1

Related Questions