1 16 17 package org.apache.xerces.jaxp.validation; 18 19 import org.apache.xerces.xni.grammars.Grammar; 20 import org.apache.xerces.xni.grammars.XMLGrammarDescription; 21 import org.apache.xerces.xni.grammars.XMLGrammarPool; 22 23 30 final class SimpleXMLSchema extends AbstractXMLSchema implements XMLGrammarPool { 31 32 33 private static final Grammar [] ZERO_LENGTH_GRAMMAR_ARRAY = new Grammar [0]; 34 35 private Grammar fGrammar; 36 private Grammar[] fGrammars; 37 private XMLGrammarDescription fGrammarDescription; 38 39 public SimpleXMLSchema(Grammar grammar) { 40 fGrammar = grammar; 41 fGrammars = new Grammar[] {grammar}; 42 fGrammarDescription = grammar.getGrammarDescription(); 43 } 44 45 48 49 public Grammar[] retrieveInitialGrammarSet(String grammarType) { 50 return XMLGrammarDescription.XML_SCHEMA.equals(grammarType) ? 51 (Grammar[]) fGrammars.clone() : ZERO_LENGTH_GRAMMAR_ARRAY; 52 } 53 54 public void cacheGrammars(String grammarType, Grammar[] grammars) {} 55 56 public Grammar retrieveGrammar(XMLGrammarDescription desc) { 57 return fGrammarDescription.equals(desc) ? fGrammar : null; 58 } 59 60 public void lockPool() {} 61 62 public void unlockPool() {} 63 64 public void clear() {} 65 66 69 70 public XMLGrammarPool getGrammarPool() { 71 return this; 72 } 73 74 public boolean isFullyComposed() { 75 return true; 76 } 77 78 } | Popular Tags |