Re: Must XML schema elements by imported in WSDL 2.0?

Roberto, I agree with your proposal.

I did an experiment with Xerces. Consider the following valid schema, 
test1.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://www.example.org/test1"
        xmlns:tns="http://www.example.org/test1">
 
        <import namespace="http://www.w3.org/2001/XMLSchema"></import>

        <complexType name="schemaType">
                <sequence>
                        <element ref="schema"></element>
                </sequence>
        </complexType>
</schema>

If I remove the <import> Xerces gives me the following error:

src-resolve.4.2: Error resolving component 'schema'. It was detected that 
'schema' is in namespace 'http://www.w3.org/2001/XMLSchema', but 
components from this namespace are not referenceable from schema document 
'file:///D:/workspaces/WSD/schematest/test1.xsd'. If this is the incorrect 
namespace, perhaps the prefix of 'schema' needs to be changed. If this is 
the correct namespace, then an appropriate 'import' tag should be added to 
'file:///D:/workspaces/WSD/schematest/test1.xsd'.

Therefore, to be consistent with XSD, we must require the <import> when 
refering to elements. In contrast, the following valid schema test2.xsd 
refers to a built-in simple type and there is no <import>

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://www.example.org/test2"
        xmlns:tns="http://www.example.org/test2">
 
        <complexType name="countType">
                <sequence>
                        <element name="count" type="int"></element>
                </sequence>
        </complexType>
</schema>

Arthur Ryman,
IBM Software Group, Rational Division

blog: http://ryman.eclipsedevelopersjournal.com/
phone: +1-905-413-3077, TL 969-3077
assistant: +1-905-413-2411, TL 969-2411
fax: +1-905-413-4920, TL 969-4920
mobile: +1-416-939-5063, text: 4169395063@fido.ca

Received on Thursday, 16 March 2006 17:58:53 UTC