Hello, I am trying to load a grammar for a schema that references the 'schema' element from XML schema. Here it is a concise example:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="type"> <xs:sequence> <xs:element name="string" type="xs:string"/> <xs:element ref="xs:schema"/> </xs:sequence> </xs:complexType> </xs:schema> When I load the schema, I get the following error: [Error] :5:36: src-resolve.4.2: Error resolving component 'xs:schema'. It was detected that 'xs:schema' is in namespace 'http://www.w3.org/2001/XMLSchema', but components from this namespace are not referenceable from schema document 'null'. If this is the incorrect namespace, perhaps the prefix of 'xs:schema' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'null'. This error occurs when the grammar loader tries to resolve the element declaration that references the 'xs:schema' element. Why is it that the grammar loader can resolve the reference to 'xs:string' but not 'xs:schema'? Are the global types defined by XML Schema known intrinsically (built-in) to xerces but not the global elements? Is this a bug in xerces or do I need to add an import statement for the XML Schema schema and create an entity resolver to load the 'XML Schema' schema into the schema loader as well? If it helps, I've included the program that I am using to load the schema below. Thanks, Kevin import org.apache.xerces.impl.xs.XMLSchemaLoader; import org.apache.xerces.xni.parser.XMLInputSource; import java.io.StringReader; public class LoadSchemaTest { public static void main(String[] args) throws Exception { String schemaString = "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + " <xs:complexType name=\"type\">\n" + " <xs:sequence>\n" + " <xs:element name=\"string\" type=\"xs:string\"/>\n" + " <xs:element ref=\"xs:schema\"/>\n" + " </xs:sequence>\n" + " </xs:complexType>\n" + "</xs:schema>"; XMLSchemaLoader loader = new XMLSchemaLoader(); XMLInputSource inputSource = new XMLInputSource( null, null, null, new StringReader(schemaString), null); loader.loadGrammar(inputSource); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]