Hi Michael, I don't understand. The Grammar Pool doesn't seem to have any say in the matter. I have a schema, say a.xsd and two documents a.xml and b.xml. The document a.xml references schema a.xsd and is valid according to the schema. The document b.xml has the same root element as a.xml but does NOT reference the schema and is not valid according to the schema. Assuming a.xsd is in the grammar cache, if I parse b.xml, the only calls to the implementation of GrammarPool are to retrieveInitialGrammarSet(). How does the Grammar Pool know whether or not a schema location hint was provided by the instance document? The only info that I get passed is "http://www.w3.org/2001/XMLSchema" and http://www.w3.org/TR/REC-XML. One thing that may be relevant is that my schema don't have a target namespace. Cheers Russell Thamm
________________________________ From: Michael Glavassevich [mailto:[EMAIL PROTECTED] Sent: Monday, 8 September 2008 2:51 PM To: j-users@xerces.apache.org Subject: Re: http://apache.org/xml/features/validation/dynamic does not work as documented Hi Russell, "Thamm, Russell" <[EMAIL PROTECTED]> wrote on 09/08/2008 12:08:59 AM: > Hi, > it appears that the dynamic validation feature does not work as documented. > If a document that does NOT specify a schema is parsed and the > grammar pool contains a matching schema (ie a schema that defines > the root element of the document), > the document is validated. > This IS NOT what the documentation says: "The parser will validate > the document only if a grammar is specified." It was specified by the grammar pool. > When I googled this, I found someone who stated that: > If dynamic validation is set to true, and validation is set to true, > validation will only occur if a grammar is found. > This appears to match the way the software works but contradicts the > documentation (specified is not the same as found). > Can I use grammar caching and get xerces to validate only documents > that specify a schema? Grammar pool is an interface [1]. You're in control of what it returns. If you want it to only return a grammar if a schema location hint was provided by the instance document then you need to change your implementation of grammar pool to behave as such. > Cheers > Russell Thamm Thanks. [1] http://xerces.apache.org/xerces2-j/javadocs/xni/org/apache/xerces/xni/gr ammars/XMLGrammarPool.html Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email.