Greetings, I am using Sun JDK1.4.2_11 w/Xerces 2.8.0 on the Win32 platform. I have the following sample code which works fine: ... Source[] xsdSources = ...; Document xmlDocument = ...; Schema schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(xsdSources); Validator validator = schema.newValidator(); validator.validate(new DOMSource(xmlDocument.getDocumentElement())); If I modify the code to look like that listed below (note the add'l newSchema invocation), I receive the following SAXParseException: cvc-elt.1: Cannot find the declaration of element 'myGlobalElement'. ... Source[] xsdSources=...; Document xmlDocument = ...; Schema schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(xsdSources); schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(xsdSources); Validator validator = schema.newValidator(); validator.validate(new DOMSource(xmlDocument.getDocumentElement())); In the debugger, I noticed that the schema generated by the first newSchema invocation contains a SchemaGrammar whose fGlobalElemDecls contains entries for all my global elements. However, after the second newSchema invocation, the SchemaGrammar in the newly constructed schema has a fGlobalElemDecls data structure with all null entries. This would explain the SAXParseException in the second example above. The schemas in my production application change on the fly. When one changes, I need to invoke newSchema to build a new Schema to use for validation. This is not working. Thanks in advance for your help. - Ron
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
