Defining a complexType in xsd: Src-resolve: Cannot Resolve The Name 'variable1' To A(n) 'type Definition' Component

StackOverflow https://stackoverflow.com/questions/12433742

Question

I get an error:

Src-resolve: Cannot Resolve The Name 'variable1' To A(n) 'type Definition' Component.

by validating the following scheme:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

               ...

                            <xs:element name="variables" maxOccurs="1">
                            <xs:complexType>
                                <xs:annotation>
                                    <xs:documentation>AWK external variables (from bash)</xs:documentation>
                                </xs:annotation>
                                <xs:sequence>
                                    <xs:element name="variable" type="variable" minOccurs="1"/>
                                    <xs:complexType name="variable">
                                        <xs:sequence>
                                            <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
                                            <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="1"/>
                                        </xs:sequence>
                                    </xs:complexType>
                                </xs:sequence>
                            </xs:complexType>
                        </xs:element>



             ...

</xs:schema>

What could be wrong? I want define a global complexType "variable" as the "BookType" described here: http://www.ibm.com/developerworks/library/xml-schema/#list9

Was it helpful?

Solution

Simply move the content of the element starting <xs:complexType name="variable"> as a child of the xs:schema.

A type is one of those things in XML Schema that cannot be named unless its parent is the xs:schema (or a redefine, but that's another thing).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top