public void cacheGrammars(String grammarType, Grammar[] grammars) { synchronized (fGrammarPool) { fGrammarPool.cacheGrammars(grammarType, grammars); } } // cacheGrammars(String, Grammar[]);
public void cacheGrammars(String grammarType, Grammar[] grammars) { fGrammarPool.cacheGrammars(grammarType, grammars); }
/** * Give the grammarPool the option of caching these grammars. * This certainly must be synchronized. * * @param grammarType The type of the grammars to be cached. * @param grammars The Grammars that may be cached (unordered, Grammars previously * given to the validator may be included). */ public void cacheGrammars(String grammarType, Grammar[] grammars) { // better give both grammars a shot... super.cacheGrammars(grammarType, grammars); fGrammarPool.cacheGrammars(grammarType, grammars); } // cacheGrammars(grammarType, Grammar[]);
public void setAttribute(String name, Object value) throws IllegalArgumentException { if (name.equals("http://www.galdosinc.com/xml/properties/schemaLocation")) { try { this.grammarPool.cacheGrammars("XmlSchema", new Grammar[] { GrammarUtil.parseGrammar(new URL(value.toString()), this.grammarPool) }); } catch (IOException e) { throw new IllegalArgumentException(e.getMessage()); } } else if (name.startsWith("http://www.galdosinc.com/xml/properties/dtdLocation/")) { String rootName = name.substring("http://www.galdosinc.com/xml/properties/dtdLocation/".length()); this.dtds.put(rootName, value.toString()); } else { super.setAttribute(name, value); } } }
private void initGrammarPool(ASModelImpl currModel, XMLGrammarPool grammarPool) { // put all the grammars in fAbstractSchema into the grammar pool. // grammarPool must never be null! Grammar[] grammars = new Grammar[1]; if ((grammars[0] = (Grammar)currModel.getGrammar()) != null) { grammarPool.cacheGrammars(grammars[0].getGrammarDescription().getGrammarType(), grammars); } Vector modelStore = currModel.getInternalASModels(); for (int i = 0; i < modelStore.size(); i++) { initGrammarPool((ASModelImpl)modelStore.elementAt(i), grammarPool); } } } // class DOMASBuilderImpl
fDTDGrammar.endDTD(augs); if(fGrammarPool != null) fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_DTD, new Grammar[] {fDTDGrammar});
DTDGrammar parseDTD(XMLInputSource is) throws IOException { XMLEntityResolver resolver = getEntityResolver(); if(resolver != null) { fDTDLoader.setEntityResolver(resolver); } fDTDLoader.setProperty(ERROR_REPORTER, fErrorReporter); // Should check whether the grammar with this namespace is already in // the grammar resolver. But since we don't know the target namespace // of the document here, we leave such check to the application... DTDGrammar grammar = (DTDGrammar)fDTDLoader.loadGrammar(is); // by default, hand it off to the grammar pool if (grammar != null) { fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_DTD, new Grammar[]{grammar}); } return grammar; } // parseXMLDTD(XMLInputSource) : DTDGrammar
fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_SCHEMA, fGrammarBucket.getGrammars());
SchemaGrammar parseXMLSchema(XMLInputSource is) throws IOException { XMLEntityResolver resolver = getEntityResolver(); if(resolver != null) { fSchemaLoader.setEntityResolver(resolver); } if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) { fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter()); } fSchemaLoader.setProperty(ERROR_REPORTER, fErrorReporter); String propPrefix = Constants.XERCES_PROPERTY_PREFIX; String propName = propPrefix + Constants.SCHEMA_LOCATION; fSchemaLoader.setProperty(propName, getProperty(propName)); propName = propPrefix + Constants.SCHEMA_NONS_LOCATION; fSchemaLoader.setProperty(propName, getProperty(propName)); propName = Constants.JAXP_PROPERTY_PREFIX+Constants.SCHEMA_SOURCE; fSchemaLoader.setProperty(propName, getProperty(propName)); fSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, getFeature(SCHEMA_FULL_CHECKING)); // Should check whether the grammar with this namespace is already in // the grammar resolver. But since we don't know the target namespace // of the document here, we leave such check to XSDHandler SchemaGrammar grammar = (SchemaGrammar)fSchemaLoader.loadGrammar(is); // by default, hand it off to the grammar pool if (grammar != null) { fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_SCHEMA, new Grammar[]{grammar}); } return grammar; } // parseXMLSchema(XMLInputSource) : SchemaGrammar
fGrammarPool.cacheGrammars(XMLDTDDescription.XML_DTD, new Grammar[] {fDTDGrammar});
grammars[k].setImmutable(true); fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_SCHEMA, grammars);