You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Jeehong Min <je...@parasoft.com> on 2004/05/28 20:27:02 UTC

Error resolving s:schema in a schema

Xerces users and developers,

I have a schema that references the "schema" element in the http://www.w3.org//2001/XMLSchema namespace.
Notice the element in the sequence that references the "schema" element.

<s:schema elementFormDefault="qualified" targetNamespace="http://foobar.com">

      <s:element name="GetFooBar">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetFooBarResult">
              <s:complexType>
                <s:sequence>
                  <s:element ref="s:schema" />
                  <s:any />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>

</s:schema>

I have a few questions:

1) Is it necessary to include an import statement with the following?

<s:import namespace="http://www.w3.org/2001/XMLSchema"/ schemaLocation="http://www.w3.org/2001/XMLSchema.xsd" /> 

2) If so, why?  It appears that the Xerces parser can resolve other elements defined in the "XML Schema for Schemas" such as string, boolean, etc. without the import statesment.

Without the import statement, I am currently getting the following error:

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

with stack trace:

        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unk
nown Source)
        at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(Unknown
 Source)
        at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseLoca
l(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseLoca
l(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDAbstractParticleTraverser.tra
verseSeqChoice(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDAbstractParticleTraverser.tra
verseSequence(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.processC
omplexContent(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverse
ComplexTypeDecl(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverse
Local(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseName
dElement(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseLoca
l(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseLocalElements
(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown S
ource)
        at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)