| Hi, I am using a grammarpool to cache schemas and want the user to point to a number of schemas that will be added to the grammarpool. Then the grammarpool is used to validate a XML instance document. One of the schema (=top ) uses a include to another schema (=sub ). If I can rely on the location mentioned in the include there is no problem. Just add "top" to the pool and everything is fine. But when the path in the top schema is invalid, the included schema cannot be found. My first idea was just let the user add the subschema also to the pool. But this has no effect. The result is that the subschema is just ignored and will not be in the grammarpool (likely caused by the fact that there is already a grammar with the same namespace in the pool, namely "top"). Validation will be incomplete because the type definitions mentioned in sub are ignored. Working in the other direction (first add the sub, then the top schema) does not not work either: only the sub schema will be added to the grammarpool The ideal situation for me would be: just add another schema to the pool if the parser gives an error that something cannot be found. Is there no other way then using a entityresolver? If so: can I detect in the entityresolver that the schema will or will not be found by the parser.if "not" , I have to return my own inputsource. Can I also use such a entityresolver when using a XMLGrammarPreparser? PS You can easily "replay" the above situations with the XMLGrammarBuilder.java program that is supplied with xerces. But also using direct (without preparsing) the dom or sax parser with a grammarpool will give the same results. I used these xml and schemas top.xsd: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:include schemaLocation="include.xsd"/> <xsd:element name="myRoot" type="myRootType"/> <xsd:complexType name="myRootType"> <xsd:sequence> <xsd:element name="label" type="labelType"/> </xsd:sequence> </xsd:complexType> </xsd:schema> include.xsd: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:simpleType name="labelType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="01"/> <xsd:enumeration value="02"/> </xsd:restriction> </xsd:simpleType> </xsd:schema> instance.xml: <?xml version="1.0" encoding="UTF-8"?> <myRoot> <label>028</label> </myRoot> |
- Using grammarpool with included schemas Dick Deneer
- Re: Using grammarpool with included schemas Michael Glavassevich
- Re: Using grammarpool with included schemas Dick Deneer
- Re: Using grammarpool with included sche... Joseph Kesselman
- Re: Using grammarpool with included ... Dick Deneer
- Re: Using grammarpool with incl... Michael Glavassevich
- Re: Using grammarpool with ... Dick Deneer
- Re: Using grammarpool w... Michael Glavassevich
- Re: Using grammarpool with included schemas Michael Glavassevich
- Re: Using grammarpool with included schemas Michael Glavassevich
