Methods Summary |
---|
private void | addGrammars(com.sun.org.apache.xerces.internal.dom.ASModelImpl model, com.sun.org.apache.xerces.internal.impl.xs.XSGrammarBucket grammarBucket)
SchemaGrammar [] grammarList = grammarBucket.getGrammars();
for(int i=0; i<grammarList.length; i++) {
ASModelImpl newModel = new ASModelImpl();
newModel.setGrammar(grammarList[i]);
model.addASModel(newModel);
}
|
public com.sun.org.apache.xerces.internal.dom3.as.ASModel | getAbstractSchema()Associate an ASModel with a document instance. This
ASModel will be used by the "
validate-if-schema " and "
datatype-normalization " options during the load of a new
Document .
return fAbstractSchema;
|
private void | initGrammarBucket()
fGrammarBucket.reset();
if (fAbstractSchema != null)
initGrammarBucketRecurse(fAbstractSchema);
|
private void | initGrammarBucketRecurse(com.sun.org.apache.xerces.internal.dom.ASModelImpl currModel)
if(currModel.getGrammar() != null) {
fGrammarBucket.putGrammar(currModel.getGrammar());
}
for(int i = 0; i < currModel.getInternalASModels().size(); i++) {
ASModelImpl nextModel = (ASModelImpl)(currModel.getInternalASModels().elementAt(i));
initGrammarBucketRecurse(nextModel);
}
|
private void | initGrammarPool(com.sun.org.apache.xerces.internal.dom.ASModelImpl currModel, com.sun.org.apache.xerces.internal.xni.grammars.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);
}
|
public com.sun.org.apache.xerces.internal.dom3.as.ASModel | parseASInputSource(org.w3c.dom.ls.LSInput is)Parse a Abstract Schema from a location identified by an
LSInput .
// need to wrap the LSInput with an XMLInputSource
XMLInputSource xis = this.dom2xmlInputSource(is);
try {
return parseASInputSource(xis);
}
catch (XNIException e) {
Exception ex = e.getException();
throw ex;
}
|
com.sun.org.apache.xerces.internal.dom3.as.ASModel | parseASInputSource(com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource is)
if (fGrammarBucket == null) {
fGrammarBucket = new XSGrammarBucket();
}
initGrammarBucket();
// actually do the parse:
// save some casting
XMLGrammarCachingConfiguration gramConfig = (XMLGrammarCachingConfiguration)fConfiguration;
// ensure grammarPool doesn't absorb grammars while it's parsing
gramConfig.lockGrammarPool();
SchemaGrammar grammar = gramConfig.parseXMLSchema(is);
gramConfig.unlockGrammarPool();
ASModelImpl newAsModel = null;
if (grammar != null) {
newAsModel = new ASModelImpl();
fGrammarBucket.putGrammar (grammar, true);
addGrammars(newAsModel, fGrammarBucket);
}
return newAsModel;
|
public com.sun.org.apache.xerces.internal.dom3.as.ASModel | parseASURI(java.lang.String uri)Parse a Abstract Schema from a location identified by an URI.
XMLInputSource source = new XMLInputSource(null, uri, null);
return parseASInputSource(source);
|
public void | setAbstractSchema(com.sun.org.apache.xerces.internal.dom3.as.ASModel abstractSchema)Associate an ASModel with a document instance. This
ASModel will be used by the "
validate-if-schema " and "
datatype-normalization " options during the load of a new
Document .
// since the ASModel associated with this object is an attribute
// according to the DOM IDL, we must obliterate anything
// that was set before, rather than adding to it.
// REVISIT: so shouldn't we attempt to clear the
// grammarPool before adding stuff to it? - NG
fAbstractSchema = (ASModelImpl)abstractSchema;
// make sure the GrammarPool is properly initialized.
XMLGrammarPool grammarPool = (XMLGrammarPool)fConfiguration.getProperty(StandardParserConfiguration.XMLGRAMMAR_POOL);
// if there is no grammar pool, create one
// REVISIT: ASBuilder should always create one.
if (grammarPool == null) {
// something's not right in this situation...
grammarPool = new XMLGrammarPoolImpl();
fConfiguration.setProperty(StandardParserConfiguration.XMLGRAMMAR_POOL,
grammarPool);
}
if (fAbstractSchema != null) {
initGrammarPool(fAbstractSchema, grammarPool);
}
|