Question

Every time I try to validate the below xsd file using XMLSpy 2012, I get the following error:

'Credentials' must refer to an existing type.

I'm sure it's something stupid I'm doing but I just don't see it.

Thanks.

                <?xml version="1.0" encoding="UTF-8"?>
                <!--W3C Schema generated by XMLSpy v2011 rel. 2 (x64) (http://www.altova.com)-->
                <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:qvd="http://www.MyCompany.com/qvd" targetNamespace="http://www.MyCompany.com/qvd" elementFormDefault="qualified" attributeFormDefault="unqualified">
                    <annotation>
                        <documentation>
                QueryViewer Defaults config file schema
                Copyright 2012 MyCompany. All rights reserved.
                </documentation>
                    </annotation>
                    <element name="QueryViewerDefaults">
                        <complexType>
                            <sequence>
                                <element name="CompanyName" type="string"/>
                                <element name="QueryPath" type="string"/>
                                <element name="Credentials" type="Credentials"/>
                            </sequence>
                            <attribute name="created" use="required" type="dateTime"/>
                            <attribute name="modified" use="required" type="dateTime"/>
                            <attribute name="fileversion" use="required" type="string"/>
                        </complexType>
                    </element>
                    <complexType name="Credentials">
                        <sequence>
                            <element name="Server" type="string"/>
                            <element name="Database" type="string"/>
                            <element name="UserID" type="string"/>
                            <element name="Password" type="string"/>
                            <element name="IntegratedSecurity" type="boolean" default="false"/>
                        </sequence>
                        <attribute name="encrypted" type="boolean" use="optional" default="false"/>
                    </complexType>
                </schema>
Was it helpful?

Solution

That is because Credentials belongs to http://www.MyCompany.com/qvd namespace as that is what you defined as the targetNamespace in your xsd. So change the below

<element name="Credentials" type="Credentials"/>

to

<element name="Credentials" type="qvd:Credentials"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top