You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ne...@apache.org on 2002/01/18 00:54:59 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/xni XMLResourceIdentifier.java
neilg 02/01/17 15:54:59
Modified: java/src/org/apache/xerces/parsers CachingParserPool.java
DOMASBuilderImpl.java DOMBuilderImpl.java
DOMParser.java DTDXSParserConfiguration.java
SAXParser.java StandardParserConfiguration.java
XMLDocumentParser.java
java/src/org/apache/xerces/impl Constants.java
java/src/org/apache/xerces/impl/dtd DTDGrammarBucket.java
AbstractDTDGrammar.java
java/src/org/apache/xerces/impl/xs/traversers
XSDHandler.java
java/src/org/apache/xerces/impl/xs XMLSchemaValidator.java
SchemaGrammar.java
java/samples/xni/parser PSVIConfiguration.java
Added: java/src/org/apache/xerces/impl/dtd XMLDTDDescription.java
java/src/org/apache/xerces/xni/grammars XMLGrammarPool.java
XMLGrammarDescription.java Grammar.java
java/src/org/apache/xerces/xni XMLResourceIdentifier.java
Removed: java/src/org/apache/xerces/impl/validation Grammar.java
GrammarPool.java
Log:
phase 2 of Grammar caching-related updates. Now the new interfaces are added, and the Grammar class (now an interface) has been moved to the new xni.grammars package from its former home in impl.validation. All classes have been changed to use the new GrammarPool. Still to do: 1. add XSDDescription.java; 2. incorporate the new XMLResourceIdentifier into XNI callbacks; 3. extend XMLLocator from XMLResourceIdentifier; 4. make sure docs are up-to-date to reflect new ways of doing things.
Revision Changes Path
1.5 +101 -20 xml-xerces/java/src/org/apache/xerces/parsers/CachingParserPool.java
Index: CachingParserPool.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/CachingParserPool.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CachingParserPool.java 6 Dec 2001 21:49:37 -0000 1.4
+++ CachingParserPool.java 17 Jan 2002 23:54:58 -0000 1.5
@@ -57,8 +57,10 @@
package org.apache.xerces.parsers;
-import org.apache.xerces.impl.validation.Grammar;
-import org.apache.xerces.impl.validation.GrammarPool;
+import org.apache.xerces.xni.grammars.Grammar;
+import org.apache.xerces.xni.grammars.XMLGrammarPool;
+import org.apache.xerces.xni.grammars.XMLGrammarDescription;
+import org.apache.xerces.impl.validation.XMLGrammarPoolImpl;
import org.apache.xerces.util.SymbolTable;
@@ -92,7 +94,7 @@
* @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
* @author Andy Clark, IBM
*
- * @version $Id: CachingParserPool.java,v 1.4 2001/12/06 21:49:37 neilg Exp $
+ * @version $Id: CachingParserPool.java,v 1.5 2002/01/17 23:54:58 neilg Exp $
*/
public class CachingParserPool {
@@ -122,7 +124,7 @@
* constructed with is automatically wrapped in a synchronized
* version for thread-safety.
*/
- protected GrammarPool fSynchronizedGrammarPool;
+ protected XMLGrammarPool fSynchronizedGrammarPool;
/**
* Shadow the symbol table for new parser instances. If true,
@@ -148,7 +150,7 @@
/** Default constructor. */
public CachingParserPool() {
- this(new SymbolTable(), new GrammarPool());
+ this(new SymbolTable(), new XMLGrammarPoolImpl());
} // <init>()
/**
@@ -158,10 +160,10 @@
* @param symbolTable The symbol table.
* @param grammarPool The grammar pool.
*/
- public CachingParserPool(SymbolTable symbolTable, GrammarPool grammarPool) {
+ public CachingParserPool(SymbolTable symbolTable, XMLGrammarPool grammarPool) {
fSynchronizedSymbolTable = new SynchronizedSymbolTable(symbolTable);
fSynchronizedGrammarPool = new SynchronizedGrammarPool(grammarPool);
- } // <init>(SymbolTable,GrammarPool)
+ } // <init>(SymbolTable,XMLGrammarPool)
//
// Public methods
@@ -173,9 +175,9 @@
} // getSymbolTable():SymbolTable
/** Returns the grammar pool. */
- public GrammarPool getGrammarPool() {
+ public XMLGrammarPool getXMLGrammarPool() {
return fSynchronizedGrammarPool;
- } // getGrammarPool():GrammarPool
+ } // getXMLGrammarPool():XMLGrammarPool
// setters and getters
@@ -202,7 +204,7 @@
SymbolTable symbolTable = fShadowSymbolTable
? new ShadowedSymbolTable(fSynchronizedSymbolTable)
: fSynchronizedSymbolTable;
- GrammarPool grammarPool = fShadowGrammarPool
+ XMLGrammarPool grammarPool = fShadowGrammarPool
? new ShadowedGrammarPool(fSynchronizedGrammarPool)
: fSynchronizedGrammarPool;
return new DOMParser(symbolTable, grammarPool);
@@ -213,7 +215,7 @@
SymbolTable symbolTable = fShadowSymbolTable
? new ShadowedSymbolTable(fSynchronizedSymbolTable)
: fSynchronizedSymbolTable;
- GrammarPool grammarPool = fShadowGrammarPool
+ XMLGrammarPool grammarPool = fShadowGrammarPool
? new ShadowedGrammarPool(fSynchronizedGrammarPool)
: fSynchronizedGrammarPool;
return new SAXParser(symbolTable, grammarPool);
@@ -416,50 +418,90 @@
* @author Andy Clark, IBM
*/
public static final class SynchronizedGrammarPool
- extends GrammarPool {
+ implements XMLGrammarPool {
//
// Data
//
/** Main grammar pool. */
- private GrammarPool fGrammarPool;
+ private XMLGrammarPool fGrammarPool;
//
// Constructors
//
/** Constructs a synchronized grammar pool. */
- public SynchronizedGrammarPool(GrammarPool grammarPool) {
+ public SynchronizedGrammarPool(XMLGrammarPool grammarPool) {
fGrammarPool = grammarPool;
- } // <init>(GrammarPool)
+ } // <init>(XMLGrammarPool)
//
// GrammarPool methods
//
+ // retrieve the initial set of grammars for the validator
+ // to work with.
+ // REVISIT: does this need to be synchronized since it's just reading?
+ // @param grammarType type of the grammars to be retrieved.
+ // @return the initial grammar set the validator may place in its "bucket"
+ public Grammar [] retrieveInitialGrammarSet(String grammarType ) {
+ synchronized (fGrammarPool) {
+ return fGrammarPool.retrieveInitialGrammarSet(grammarType);
+ }
+ } // retrieveInitialGrammarSet(String): Grammar[]
+
+ // retrieve a particular grammar.
+ // REVISIT: does this need to be synchronized since it's just reading?
+ // @param gDesc description of the grammar to be retrieved
+ // @return Grammar corresponding to gDesc, or null if none exists.
+ public Grammar retrieveGrammar(XMLGrammarDescription gDesc) {
+ synchronized (fGrammarPool) {
+ return fGrammarPool.retrieveGrammar(gDesc);
+ }
+ } // retrieveGrammar(XMLGrammarDesc): Grammar
+
+ // 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) {
+ synchronized (fGrammarPool) {
+ fGrammarPool.cacheGrammars(grammarType, grammars);
+ }
+ } // cacheGrammars(String, Grammar[]);
+
+ /***
+ * Methods corresponding to original (pre Xerces2.0.0final)
+ * grammarPool have been commented out.
+ */
/**
* Puts the specified grammar into the grammar pool.
*
* @param key Key to associate with grammar.
* @param grammar Grammar object.
*/
+ /******
public void putGrammar(String key, Grammar grammar) {
synchronized (fGrammarPool) {
fGrammarPool.putGrammar(key, grammar);
}
} // putGrammar(String,Grammar)
+ *******/
/**
* Returns the grammar associated to the specified key.
*
* @param key The key of the grammar.
*/
+ /**********
public Grammar getGrammar(String key) {
synchronized (fGrammarPool) {
return fGrammarPool.getGrammar(key);
}
} // getGrammar(String):Grammar
+ ***********/
/**
* Removes the grammar associated to the specified key from the
@@ -467,11 +509,13 @@
*
* @param key The key of the grammar.
*/
+ /**********
public Grammar removeGrammar(String key) {
synchronized (fGrammarPool) {
return fGrammarPool.removeGrammar(key);
}
} // removeGrammar(String):Grammar
+ ******/
/**
* Returns true if the grammar pool contains a grammar associated
@@ -479,35 +523,40 @@
*
* @param key The key of the grammar.
*/
+ /**********
public boolean containsGrammar(String key) {
synchronized (fGrammarPool) {
return fGrammarPool.containsGrammar(key);
}
} // containsGrammar(String):boolean
+ ********/
} // class SynchronizedGrammarPool
/**
* Shadowed grammar pool.
+ * This class is predicated on the existence of a concrete implementation;
+ * so using our own doesn't seem to bad an idea.
*
* @author Andy Clark, IBM
+ * @author Neil Graham, IBM
*/
public static final class ShadowedGrammarPool
- extends GrammarPool {
+ extends XMLGrammarPoolImpl {
//
// Data
//
/** Main grammar pool. */
- private GrammarPool fGrammarPool;
+ private XMLGrammarPool fGrammarPool;
//
// Constructors
//
/** Constructs a shadowed grammar pool. */
- public ShadowedGrammarPool(GrammarPool grammarPool) {
+ public ShadowedGrammarPool(XMLGrammarPool grammarPool) {
fGrammarPool = grammarPool;
} // <init>(GrammarPool)
@@ -515,6 +564,38 @@
// GrammarPool methods
//
+ // retrieve the initial set of grammars for the validator
+ // to work with.
+ // REVISIT: does this need to be synchronized since it's just reading?
+ // @param grammarType type of the grammars to be retrieved.
+ // @return the initial grammar set the validator may place in its "bucket"
+ public Grammar [] retrieveInitialGrammarSet(String grammarType ) {
+ Grammar [] grammars = super.retrieveInitialGrammarSet(grammarType);
+ if (grammars != null) return grammars;
+ return fGrammarPool.retrieveInitialGrammarSet(grammarType);
+ } // retrieveInitialGrammarSet(String): Grammar[]
+
+ // retrieve a particular grammar.
+ // REVISIT: does this need to be synchronized since it's just reading?
+ // @param gDesc description of the grammar to be retrieved
+ // @return Grammar corresponding to gDesc, or null if none exists.
+ public Grammar retrieveGrammar(XMLGrammarDescription gDesc) {
+ Grammar g = super.retrieveGrammar(gDesc);
+ if(g != null) return g;
+ return fGrammarPool.retrieveGrammar(gDesc);
+ } // retrieveGrammar(XMLGrammarDesc): Grammar
+
+ // 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[]);
+
/**
* Returns the grammar associated to the specified key.
*
@@ -525,7 +606,7 @@
if (super.containsGrammar(key)) {
return super.getGrammar(key);
}
- return fGrammarPool.getGrammar(key);
+ return null;
} // getGrammar(String):Grammar
@@ -536,7 +617,7 @@
* @param key The key of the grammar.
*/
public boolean containsGrammar(String key) {
- return super.containsGrammar(key) || fGrammarPool.containsGrammar(key);
+ return super.containsGrammar(key);
} // containsGrammar(String):boolean
} // class ShadowedGrammarPool
1.4 +10 -6 xml-xerces/java/src/org/apache/xerces/parsers/DOMASBuilderImpl.java
Index: DOMASBuilderImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DOMASBuilderImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DOMASBuilderImpl.java 17 Jan 2002 17:59:33 -0000 1.3
+++ DOMASBuilderImpl.java 17 Jan 2002 23:54:58 -0000 1.4
@@ -80,7 +80,8 @@
import org.apache.xerces.xni.parser.XMLInputSource;
import org.apache.xerces.xni.parser.XMLParserConfiguration;
-import org.apache.xerces.impl.validation.GrammarPool;
+import org.apache.xerces.xni.grammars.XMLGrammarPool;
+import org.apache.xerces.impl.validation.XMLGrammarPoolImpl;
import org.apache.xerces.impl.xs.traversers.XSDHandler;
import org.apache.xerces.impl.xs.XSGrammarBucket;
import org.apache.xerces.impl.xs.SubstitutionGroupHandler;
@@ -104,7 +105,7 @@
*
* @author Pavani Mukthipudi, Sun Microsystems Inc.
* @author Neil Graham, IBM
- * @version $Id: DOMASBuilderImpl.java,v 1.3 2002/01/17 17:59:33 neilg Exp $
+ * @version $Id: DOMASBuilderImpl.java,v 1.4 2002/01/17 23:54:58 neilg Exp $
*
*/
@@ -143,7 +144,7 @@
protected XMLErrorReporter fErrorReporter;
protected XMLEntityResolver fEntityResolver;
protected SymbolTable fSymbolTable;
- protected GrammarPool fGrammarPool = null;
+ protected XMLGrammarPool fGrammarPool = null;
protected ASModelImpl fAbstractSchema;
@@ -177,7 +178,7 @@
* Constructs a DOM Builder using the specified symbol table and
* grammar pool.
*/
- public DOMASBuilderImpl(SymbolTable symbolTable, GrammarPool grammarPool) {
+ public DOMASBuilderImpl(SymbolTable symbolTable, XMLGrammarPool grammarPool) {
super(new DTDXSParserConfiguration(symbolTable, grammarPool));
fGrammarPool = grammarPool;
}
@@ -213,7 +214,7 @@
// make sure the GrammarPool is properly initialized.
if (fGrammarPool == null) {
- fGrammarPool = (GrammarPool)fConfiguration.getProperty(StandardParserConfiguration.GRAMMAR_POOL);
+ fGrammarPool = (XMLGrammarPool)fConfiguration.getProperty(StandardParserConfiguration.XMLGRAMMAR_POOL);
}
initGrammarPool(fAbstractSchema);
}
@@ -388,10 +389,13 @@
private void initGrammarPool(ASModelImpl currModel) {
// put all the grammars in fAbstractSchema into the grammar pool.
+ // REVISIT: straighten this out when grammar caching's properly implemented!
+ if(!(fGrammarPool instanceof XMLGrammarPoolImpl)) return;
+ XMLGrammarPoolImpl poolImpl = (XMLGrammarPoolImpl)fGrammarPool;
SchemaGrammar grammar = null;
if((grammar = currModel.getGrammar()) != null) {
String tns = grammar.getTargetNamespace();
- fGrammarPool.putGrammarNS(tns, grammar);
+ poolImpl.putGrammarNS(tns, grammar);
}
Vector modelStore = currModel.getInternalASModels();
for (int i = 0; i < modelStore.size(); i++) {
1.3 +2 -2 xml-xerces/java/src/org/apache/xerces/parsers/DOMBuilderImpl.java
Index: DOMBuilderImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DOMBuilderImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DOMBuilderImpl.java 7 Dec 2001 22:58:29 -0000 1.2
+++ DOMBuilderImpl.java 17 Jan 2002 23:54:58 -0000 1.3
@@ -78,7 +78,7 @@
import org.apache.xerces.util.SymbolTable;
import org.apache.xerces.util.DOMErrorHandlerWrapper;
import org.apache.xerces.impl.Constants;
-import org.apache.xerces.impl.validation.GrammarPool;
+import org.apache.xerces.xni.grammars.XMLGrammarPool;
import org.apache.xerces.xni.XNIException;
import org.apache.xerces.xni.parser.XMLConfigurationException;
import org.apache.xerces.xni.parser.XMLInputSource;
@@ -283,7 +283,7 @@
* Constructs a DOM Builder using the specified symbol table and
* grammar pool.
*/
- public DOMBuilderImpl(SymbolTable symbolTable, GrammarPool grammarPool) {
+ public DOMBuilderImpl(SymbolTable symbolTable, XMLGrammarPool grammarPool) {
this(new DTDXSParserConfiguration(symbolTable, grammarPool));
}
1.57 +3 -3 xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java
Index: DOMParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- DOMParser.java 12 Jan 2002 02:57:59 -0000 1.56
+++ DOMParser.java 17 Jan 2002 23:54:58 -0000 1.57
@@ -61,7 +61,7 @@
import java.io.IOException;
import java.io.Reader;
-import org.apache.xerces.impl.validation.GrammarPool;
+import org.apache.xerces.xni.grammars.XMLGrammarPool;
import org.apache.xerces.util.EntityResolverWrapper;
import org.apache.xerces.util.ErrorHandlerWrapper;
import org.apache.xerces.util.ObjectFactory;
@@ -91,7 +91,7 @@
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
- * @version $Id: DOMParser.java,v 1.56 2002/01/12 02:57:59 andyc Exp $
+ * @version $Id: DOMParser.java,v 1.57 2002/01/17 23:54:58 neilg Exp $
*/
public class DOMParser
extends AbstractDOMParser {
@@ -129,7 +129,7 @@
* Constructs a DOM parser using the specified symbol table and
* grammar pool.
*/
- public DOMParser(SymbolTable symbolTable, GrammarPool grammarPool) {
+ public DOMParser(SymbolTable symbolTable, XMLGrammarPool grammarPool) {
super(new StandardParserConfiguration(symbolTable, grammarPool));
}
1.5 +6 -6 xml-xerces/java/src/org/apache/xerces/parsers/DTDXSParserConfiguration.java
Index: DTDXSParserConfiguration.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DTDXSParserConfiguration.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DTDXSParserConfiguration.java 13 Dec 2001 22:59:20 -0000 1.4
+++ DTDXSParserConfiguration.java 17 Jan 2002 23:54:58 -0000 1.5
@@ -60,7 +60,7 @@
import org.apache.xerces.impl.Constants;
import org.apache.xerces.impl.xs.XMLSchemaValidator;
import org.apache.xerces.impl.xs.XSMessageFormatter;
-import org.apache.xerces.impl.validation.GrammarPool;
+import org.apache.xerces.xni.grammars.XMLGrammarPool;
import org.apache.xerces.parsers.StandardParserConfiguration;
import org.apache.xerces.util.SymbolTable;
import org.apache.xerces.xni.parser.XMLComponentManager;
@@ -72,7 +72,7 @@
* instance document against schema.
*
* @author Sandy Gao, IBM
- * @version $Id: DTDXSParserConfiguration.java,v 1.4 2001/12/13 22:59:20 elena Exp $
+ * @version $Id: DTDXSParserConfiguration.java,v 1.5 2002/01/17 23:54:58 neilg Exp $
*/
public class DTDXSParserConfiguration extends StandardParserConfiguration {
@@ -110,9 +110,9 @@
* @param grammarPool The grammar pool to use.
*/
public DTDXSParserConfiguration(SymbolTable symbolTable,
- GrammarPool grammarPool) {
+ XMLGrammarPool grammarPool) {
this(symbolTable, grammarPool, null);
- } // <init>(SymbolTable,GrammarPool)
+ } // <init>(SymbolTable,XMLGrammarPool)
/**
* Constructs a parser configuration using the specified symbol table,
@@ -127,7 +127,7 @@
* @param parentSettings The parent settings.
*/
public DTDXSParserConfiguration(SymbolTable symbolTable,
- GrammarPool grammarPool,
+ XMLGrammarPool grammarPool,
XMLComponentManager parentSettings) {
super(symbolTable, grammarPool, parentSettings);
@@ -144,7 +144,7 @@
}
- } // <init>(SymbolTable,GrammarPool)
+ } // <init>(SymbolTable,XMLGrammarPool)
//
// Public methods
1.28 +4 -4 xml-xerces/java/src/org/apache/xerces/parsers/SAXParser.java
Index: SAXParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/SAXParser.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- SAXParser.java 12 Jan 2002 02:57:59 -0000 1.27
+++ SAXParser.java 17 Jan 2002 23:54:58 -0000 1.28
@@ -57,7 +57,7 @@
package org.apache.xerces.parsers;
-import org.apache.xerces.impl.validation.GrammarPool;
+import org.apache.xerces.xni.grammars.XMLGrammarPool;
import org.apache.xerces.util.ObjectFactory;
import org.apache.xerces.util.SymbolTable;
import org.apache.xerces.xni.parser.XMLParserConfiguration;
@@ -70,7 +70,7 @@
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
- * @version $Id: SAXParser.java,v 1.27 2002/01/12 02:57:59 andyc Exp $
+ * @version $Id: SAXParser.java,v 1.28 2002/01/17 23:54:58 neilg Exp $
*/
public class SAXParser
extends AbstractSAXParser {
@@ -107,8 +107,8 @@
* Constructs a SAX parser using the specified symbol table and
* grammar pool.
*/
- public SAXParser(SymbolTable symbolTable, GrammarPool grammarPool) {
+ public SAXParser(SymbolTable symbolTable, XMLGrammarPool grammarPool) {
super(new StandardParserConfiguration(symbolTable, grammarPool));
- } // <init>(SymbolTable,GrammarPool)
+ } // <init>(SymbolTable,XMLGrammarPool)
} // class SAXParser
1.12 +13 -12 xml-xerces/java/src/org/apache/xerces/parsers/StandardParserConfiguration.java
Index: StandardParserConfiguration.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/StandardParserConfiguration.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- StandardParserConfiguration.java 3 Jan 2002 19:50:08 -0000 1.11
+++ StandardParserConfiguration.java 17 Jan 2002 23:54:58 -0000 1.12
@@ -71,7 +71,8 @@
import org.apache.xerces.impl.validation.ValidationManager;
import org.apache.xerces.impl.dv.dtd.DatatypeValidatorFactory;
import org.apache.xerces.impl.dv.dtd.DatatypeValidatorFactoryImpl;
-import org.apache.xerces.impl.validation.GrammarPool;
+import org.apache.xerces.xni.grammars.XMLGrammarPool;
+import org.apache.xerces.impl.validation.XMLGrammarPoolImpl;
import org.apache.xerces.impl.xs.XSMessageFormatter;
import org.apache.xerces.impl.xs.XMLSchemaValidator;
@@ -121,7 +122,7 @@
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
- * @version $Id: StandardParserConfiguration.java,v 1.11 2002/01/03 19:50:08 sandygao Exp $
+ * @version $Id: StandardParserConfiguration.java,v 1.12 2002/01/17 23:54:58 neilg Exp $
*/
public class StandardParserConfiguration
extends BasicParserConfiguration
@@ -180,8 +181,8 @@
Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_SCANNER_PROPERTY;
/** Property identifier: grammar pool. */
- protected static final String GRAMMAR_POOL =
- Constants.XERCES_PROPERTY_PREFIX + Constants.GRAMMAR_POOL_PROPERTY;
+ protected static final String XMLGRAMMAR_POOL =
+ Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY;
/** Property identifier: DTD validator. */
protected static final String DTD_VALIDATOR =
@@ -215,7 +216,7 @@
// components (non-configurable)
/** Grammar pool. */
- protected GrammarPool fGrammarPool;
+ protected XMLGrammarPool fGrammarPool;
/** Datatype validator factory. */
protected DatatypeValidatorFactory fDatatypeValidatorFactory;
@@ -289,9 +290,9 @@
* @param grammarPool The grammar pool to use.
*/
public StandardParserConfiguration(SymbolTable symbolTable,
- GrammarPool grammarPool) {
+ XMLGrammarPool grammarPool) {
this(symbolTable, grammarPool, null);
- } // <init>(SymbolTable,GrammarPool)
+ } // <init>(SymbolTable,XMLGrammarPool)
/**
* Constructs a parser configuration using the specified symbol table,
@@ -306,7 +307,7 @@
* @param parentSettings The parent settings.
*/
public StandardParserConfiguration(SymbolTable symbolTable,
- GrammarPool grammarPool,
+ XMLGrammarPool grammarPool,
XMLComponentManager parentSettings) {
super(symbolTable, parentSettings);
@@ -336,7 +337,7 @@
DTD_SCANNER,
DTD_VALIDATOR,
NAMESPACE_BINDER,
- GRAMMAR_POOL,
+ XMLGRAMMAR_POOL,
DATATYPE_VALIDATOR_FACTORY,
VALIDATION_MANAGER
};
@@ -344,10 +345,10 @@
// create and register missing components
if (grammarPool == null) {
- grammarPool = new GrammarPool();
+ grammarPool = new XMLGrammarPoolImpl();
}
fGrammarPool = grammarPool;
- setProperty(GRAMMAR_POOL, fGrammarPool);
+ setProperty(XMLGRAMMAR_POOL, fGrammarPool);
fEntityManager = createEntityManager();
setProperty(ENTITY_MANAGER, fEntityManager);
@@ -410,7 +411,7 @@
// REVISIT: What is the right thing to do? -Ac
}
- } // <init>(SymbolTable,GrammarPool)
+ } // <init>(SymbolTable,XMLGrammarPool)
//
// Public methods
1.4 +3 -3 xml-xerces/java/src/org/apache/xerces/parsers/XMLDocumentParser.java
Index: XMLDocumentParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/XMLDocumentParser.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XMLDocumentParser.java 12 Jan 2002 02:57:59 -0000 1.3
+++ XMLDocumentParser.java 17 Jan 2002 23:54:58 -0000 1.4
@@ -57,7 +57,7 @@
package org.apache.xerces.parsers;
-import org.apache.xerces.impl.validation.GrammarPool;
+import org.apache.xerces.xni.grammars.XMLGrammarPool;
import org.apache.xerces.util.ObjectFactory;
import org.apache.xerces.util.SymbolTable;
import org.apache.xerces.xni.parser.XMLParserConfiguration;
@@ -71,7 +71,7 @@
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
- * @version $Id: XMLDocumentParser.java,v 1.3 2002/01/12 02:57:59 andyc Exp $
+ * @version $Id: XMLDocumentParser.java,v 1.4 2002/01/17 23:54:58 neilg Exp $
*/
public class XMLDocumentParser
extends AbstractXMLDocumentParser {
@@ -110,7 +110,7 @@
* grammar pool.
*/
public XMLDocumentParser(SymbolTable symbolTable,
- GrammarPool grammarPool) {
+ XMLGrammarPool grammarPool) {
super(new StandardParserConfiguration(symbolTable, grammarPool));
}
1.9 +3 -3 xml-xerces/java/src/org/apache/xerces/impl/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Constants.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Constants.java 7 Dec 2001 22:58:29 -0000 1.8
+++ Constants.java 17 Jan 2002 23:54:58 -0000 1.9
@@ -65,7 +65,7 @@
*
* @author Andy Clark, IBM
*
- * @version $Id: Constants.java,v 1.8 2001/12/07 22:58:29 elena Exp $
+ * @version $Id: Constants.java,v 1.9 2002/01/17 23:54:58 neilg Exp $
*/
public final class Constants {
@@ -206,7 +206,7 @@
public static final String ENTITY_RESOLVER_PROPERTY = "internal/entity-resolver";
/** Grammar pool property ("internal/grammar-pool"). */
- public static final String GRAMMAR_POOL_PROPERTY = "internal/grammar-pool";
+ public static final String XMLGRAMMAR_POOL_PROPERTY = "internal/grammar-pool";
/** Datatype validator factory ("internal/datatype-validator-factory"). */
public static final String DATATYPE_VALIDATOR_FACTORY_PROPERTY = "internal/datatype-validator-factory";
@@ -288,7 +288,7 @@
ERROR_REPORTER_PROPERTY,
ENTITY_MANAGER_PROPERTY,
ENTITY_RESOLVER_PROPERTY,
- GRAMMAR_POOL_PROPERTY,
+ XMLGRAMMAR_POOL_PROPERTY,
DATATYPE_VALIDATOR_FACTORY_PROPERTY,
DOCUMENT_SCANNER_PROPERTY,
DTD_SCANNER_PROPERTY,
1.2 +3 -3 xml-xerces/java/src/org/apache/xerces/impl/dtd/DTDGrammarBucket.java
Index: DTDGrammarBucket.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dtd/DTDGrammarBucket.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DTDGrammarBucket.java 17 Jan 2002 17:59:32 -0000 1.1
+++ DTDGrammarBucket.java 17 Jan 2002 23:54:59 -0000 1.2
@@ -57,7 +57,7 @@
package org.apache.xerces.impl.dtd;
-import org.apache.xerces.impl.validation.Grammar;
+import org.apache.xerces.xni.grammars.Grammar;
import java.util.Hashtable;
import java.util.Enumeration;
@@ -72,7 +72,7 @@
*
* @author Neil Graham, IBM
*
- * @version $Id: DTDGrammarBucket.java,v 1.1 2002/01/17 17:59:32 neilg Exp $
+ * @version $Id: DTDGrammarBucket.java,v 1.2 2002/01/17 23:54:59 neilg Exp $
*/
public class DTDGrammarBucket {
@@ -108,4 +108,4 @@
fGrammars.put(rootElement, grammar);
} // putGrammar(String,Grammar)
-} // class GrammarPool
+} // class DTDGrammarBucket
1.2 +8 -2 xml-xerces/java/src/org/apache/xerces/impl/dtd/AbstractDTDGrammar.java
Index: AbstractDTDGrammar.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dtd/AbstractDTDGrammar.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractDTDGrammar.java 17 Jan 2002 17:59:32 -0000 1.1
+++ AbstractDTDGrammar.java 17 Jan 2002 23:54:59 -0000 1.2
@@ -78,6 +78,7 @@
import org.apache.xerces.util.SymbolTable;
import org.apache.xerces.xni.QName;
+import org.apache.xerces.xni.grammars.Grammar;
/**
* A generic grammar for use in validating XML documents. The Grammar
@@ -102,9 +103,9 @@
* @author Eric Ye, IBM
* @author Andy Clark, IBM
*
- * @version $Id: AbstractDTDGrammar.java,v 1.1 2002/01/17 17:59:32 neilg Exp $
+ * @version $Id: AbstractDTDGrammar.java,v 1.2 2002/01/17 23:54:59 neilg Exp $
*/
-public abstract class AbstractDTDGrammar extends org.apache.xerces.impl.validation.Grammar implements EntityState {
+public abstract class AbstractDTDGrammar implements EntityState, Grammar {
//
// Constants
@@ -273,6 +274,11 @@
protected AbstractDTDGrammar(SymbolTable symbolTable) {
fSymbolTable = symbolTable;
} // <init>(SymbolTable)
+
+ // Grammar methods
+ public String getGrammarType() {
+ return Grammar.XML_DTD;
+ } // getGrammarType(): String
//
// Public methods
1.1 xml-xerces/java/src/org/apache/xerces/impl/dtd/XMLDTDDescription.java
Index: XMLDTDDescription.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.xerces.impl.dtd;
import org.apache.xerces.xni.grammars.XMLGrammarDescription;
import org.apache.xerces.xni.grammars.Grammar;
/*
* All information specific to dTD grammars.
*
* @author Neil Graham, IBM
* @version $Id: XMLDTDDescription.java,v 1.1 2002/01/17 23:54:59 neilg Exp $
*/
public class XMLDTDDescription implements XMLGrammarDescription {
// Data
// basic information required by XMLGrammarDescription
protected String fBaseURI = null;
protected String fLiteralSystemId = null;
protected String fExpandedSystemId = null;
protected String fPublicId = null;
// pieces of information needed to make this usable as a Grammar key
protected String fRootName = null;
protected String fInternalSubset = null;
// XMLGrammarDescription methods
public String getPublicId() {
return fPublicId;
} // getPublicId(): String
// get base URI against wihch literal systemId is expanded
public String getBaseSystemId () {
return fBaseURI;
} // getBaseSystemId(): String
// get expanded systemId
public String getExpandedSystemId () {
return fExpandedSystemId;
} // getExpandedSystemId(): String
// get systemId as found in entity decl
public String getLiteralSystemId () {
return fLiteralSystemId;
} // getLiteralSystemId(): String
public String getGrammarType () {
return Grammar.XML_DTD;
} // getGrammarType(): String
// return the root name of this DTD
public String getRootName() {
return fRootName;
} // getRootName(): String
// return the internal subset. Entities should not be expanded;
// this is simply the raw string representation of the stuff
// between [ and ]>
public String getInternalSubset () {
return fInternalSubset;
} // getInternalSubset(): String
} // class XMLDTDDescription
1.15 +2 -2 xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
Index: XSDHandler.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- XSDHandler.java 17 Jan 2002 17:59:33 -0000 1.14
+++ XSDHandler.java 17 Jan 2002 23:54:59 -0000 1.15
@@ -97,7 +97,7 @@
* schema, other grammars may be constructed as a side-effect.
*
* @author Neil Graham, IBM
- * @version $Id: XSDHandler.java,v 1.14 2002/01/17 17:59:33 neilg Exp $
+ * @version $Id: XSDHandler.java,v 1.15 2002/01/17 23:54:59 neilg Exp $
*/
public class XSDHandler {
@@ -337,7 +337,7 @@
// This method initiates the parse of a schema. It will likely be
// called from the Validator and it will make the
// resulting grammar available; it returns a reference to this object just
- // in case. An ErrorHandler, EntityResolver, GrammarPool and SymbolTable must
+ // in case. An ErrorHandler, EntityResolver, XSGrammarBucket and SymbolTable must
// already have been set; the last thing this method does is reset
// this object (i.e., clean the registries, etc.).
public SchemaGrammar parseSchema(String schemaNamespace,
1.33 +15 -11 xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Index: XMLSchemaValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- XMLSchemaValidator.java 17 Jan 2002 17:59:33 -0000 1.32
+++ XMLSchemaValidator.java 17 Jan 2002 23:54:59 -0000 1.33
@@ -64,8 +64,9 @@
import org.apache.xerces.impl.xs.identity.*;
import org.apache.xerces.impl.Constants;
import org.apache.xerces.impl.validation.ValidationManager;
-import org.apache.xerces.impl.validation.GrammarPool;
-import org.apache.xerces.impl.validation.Grammar;
+import org.apache.xerces.xni.grammars.XMLGrammarPool;
+import org.apache.xerces.impl.validation.XMLGrammarPoolImpl;
+import org.apache.xerces.xni.grammars.Grammar;
import org.apache.xerces.impl.XMLErrorReporter;
import org.apache.xerces.impl.xs.traversers.XSDHandler;
import org.apache.xerces.impl.xs.traversers.XSAttributeChecker;
@@ -126,7 +127,7 @@
* @author Elena Litani IBM
* @author Andy Clark IBM
* @author Neeraj Bajaj, Sun Microsystems, inc.
- * @version $Id: XMLSchemaValidator.java,v 1.32 2002/01/17 17:59:33 neilg Exp $
+ * @version $Id: XMLSchemaValidator.java,v 1.33 2002/01/17 23:54:59 neilg Exp $
*/
public class XMLSchemaValidator
implements XMLComponent, XMLDocumentFilter, FieldActivator {
@@ -172,8 +173,8 @@
Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
/** Property identifier: grammar pool. */
- public static final String GRAMMAR_POOL =
- Constants.XERCES_PROPERTY_PREFIX + Constants.GRAMMAR_POOL_PROPERTY;
+ public static final String XMLGRAMMAR_POOL =
+ Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY;
protected static final String VALIDATION_MANAGER =
Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY;
@@ -322,7 +323,7 @@
// updated during reset
protected ValidationManager fValidationManager = null;
protected ValidationState fValidationState = null;
- protected GrammarPool fGrammarPool;
+ protected XMLGrammarPool fGrammarPool;
// schema location property values
protected String fExternalSchemas = null;
@@ -1053,13 +1054,16 @@
// clear grammars, and put the one for schema namespace there
fGrammarBucket.reset();
fGrammarBucket.putGrammar(URI_SCHEMAFORSCHEMA, SchemaGrammar.SG_SchemaNS);
- fGrammarPool = (GrammarPool)componentManager.getProperty(GRAMMAR_POOL);
- Grammar [] initialGrammars = fGrammarPool.getGrammarsNS();
- for (int i = 0; i < initialGrammars.length; i++) {
- fGrammarBucket.putGrammar((SchemaGrammar)(initialGrammars[i]));
+ fGrammarPool = (XMLGrammarPool)componentManager.getProperty(XMLGRAMMAR_POOL);
+ if(fGrammarPool instanceof XMLGrammarPoolImpl) {
+ XMLGrammarPoolImpl poolImpl = (XMLGrammarPoolImpl)fGrammarPool;
+ Grammar [] initialGrammars = poolImpl.getGrammarsNS();
+ for (int i = 0; i < initialGrammars.length; i++) {
+ fGrammarBucket.putGrammar((SchemaGrammar)(initialGrammars[i]));
+ }
}
- // clear thing in substitution group handler
+ // clear things in substitution group handler
fSubGroupHandler.reset();
// reset schema handler and all traversal objects
1.9 +7 -3 xml-xerces/java/src/org/apache/xerces/impl/xs/SchemaGrammar.java
Index: SchemaGrammar.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/SchemaGrammar.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SchemaGrammar.java 7 Jan 2002 20:02:59 -0000 1.8
+++ SchemaGrammar.java 17 Jan 2002 23:54:59 -0000 1.9
@@ -63,7 +63,7 @@
import org.apache.xerces.util.SymbolTable;
import org.apache.xerces.util.SymbolHash;
-import org.apache.xerces.impl.validation.Grammar;
+import org.apache.xerces.xni.grammars.Grammar;
import java.util.Hashtable;
@@ -79,10 +79,10 @@
* @author Sandy Gao, IBM
* @author Elena Litani, IBM
*
- * @version $Id: SchemaGrammar.java,v 1.8 2002/01/07 20:02:59 neilg Exp $
+ * @version $Id: SchemaGrammar.java,v 1.9 2002/01/17 23:54:59 neilg Exp $
*/
-public class SchemaGrammar extends Grammar {
+public class SchemaGrammar implements Grammar {
/** Symbol table. */
private SymbolTable fSymbolTable;
@@ -154,6 +154,10 @@
} // <init>(SymbolTable, boolean)
+ // Grammar methods
+ public String getGrammarType() {
+ return Grammar.XML_SCHEMA;
+ } // getGrammarType(): String
// DTDGrammar methods
public boolean isNamespaceAware () {
return true;
1.2 +6 -6 xml-xerces/java/samples/xni/parser/PSVIConfiguration.java
Index: PSVIConfiguration.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/xni/parser/PSVIConfiguration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PSVIConfiguration.java 7 Dec 2001 22:31:13 -0000 1.1
+++ PSVIConfiguration.java 17 Jan 2002 23:54:59 -0000 1.2
@@ -60,7 +60,7 @@
import xni.PSVIWriter;
import org.apache.xerces.impl.Constants;
-import org.apache.xerces.impl.validation.GrammarPool;
+import org.apache.xerces.xni.grammars.XMLGrammarPool;
import org.apache.xerces.parsers.DTDXSParserConfiguration;
import org.apache.xerces.util.SymbolTable;
@@ -72,7 +72,7 @@
* configuration including XML Schema Validator in the pipeline.
*
* @author Elena Litani, IBM
- * @version $Id: PSVIConfiguration.java,v 1.1 2001/12/07 22:31:13 elena Exp $
+ * @version $Id: PSVIConfiguration.java,v 1.2 2002/01/17 23:54:59 neilg Exp $
*/
public class PSVIConfiguration extends DTDXSParserConfiguration {
@@ -113,9 +113,9 @@
* @param grammarPool The grammar pool to use.
*/
public PSVIConfiguration(SymbolTable symbolTable,
- GrammarPool grammarPool) {
+ XMLGrammarPool grammarPool) {
this(symbolTable, grammarPool, null);
- } // <init>(SymbolTable,GrammarPool)
+ } // <init>(SymbolTable,XMLGrammarPool)
/**
* Constructs a parser configuration using the specified symbol table,
@@ -130,7 +130,7 @@
* @param parentSettings The parent settings.
*/
public PSVIConfiguration(SymbolTable symbolTable,
- GrammarPool grammarPool,
+ XMLGrammarPool grammarPool,
XMLComponentManager parentSettings) {
super(symbolTable, grammarPool, parentSettings);
@@ -139,7 +139,7 @@
addComponent(fPSVIWriter);
}
- } // <init>(SymbolTable,GrammarPool)
+ } // <init>(SymbolTable,XMLGrammarPool)
/** Configures the pipeline. */
1.1 xml-xerces/java/src/org/apache/xerces/xni/grammars/XMLGrammarPool.java
Index: XMLGrammarPool.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.xerces.xni.grammars;
/*
* <p> This interface specifies how the parser and the application
* interact with respect to Grammar objects that the application
* possesses--either by having precompiled them or by having stored them
* from a previous validation of an instance document. It makes no
* assumptions about the kind of Grammar involved, or about how the
* application's storage mechanism works.</p>
*
* <p>The interaction works as follows:
* <ul>
* <li>When a validator considers a document, it is expected to request
* grammars of the type it can handle from this object using the
* <code>retrieveInitialGrammarSet</code> method. </li>
* <li>If it requires a grammar
* not in this set, it will request it from this Object using the
* <code>retrieveGrammar</code> method. </li>
* <li> After successfully validating an
* instance, the validator should make any new grammars it has compiled
* available to this object using the <code>cacheGrammars</code>
* method; for ease of implementation it may make other Grammars it holds references to as well (i.e.,
* it may return some grammars that were retrieved from the GrammarPool in earlier operations). </li> </ul> </p>
*
* @author Neil Graham, IBM
* @version $Id: XMLGrammarPool.java,v 1.1 2002/01/17 23:54:59 neilg Exp $
*/
public interface XMLGrammarPool {
// <p>we are trying to make this XMLGrammarPool work for all kinds of
// grammars, so we have a parameter "grammarType" for each of the
// methods. </p>
// <p> retrieve the initial known set of grammars. this method is
// called by a validator before the validation starts. the application
// can provide an initial set of grammars available to the current
// validation attempt. </p>
// @param grammarType the type of the grammar, from the
// <code>org.apache.xerces.xni.grammars.Grammar</code> interface.
// @return the set of grammars the validator may put in its "bucket"
public Grammar[] retrieveInitialGrammarSet(String grammarType);
// <p>return the final set of grammars that the validator ended up
// with.
// This method is called after the
// validation finishes. The application may then choose to cache some
// of the returned grammars. </p>
// @param grammarType the type of the grammars being returned;
// @param grammars an array containing the set of grammars being
// returned; order is not significant.
public void cacheGrammars(String grammarType, Grammar[] grammars);
// <p> This method requests that the application retrieve a grammar
// corresponding to the given GrammarIdentifier from its cache.
// If it cannot do so it must return null; the parser will then
// call the EntityResolver. <strong>An application must not call its
// EntityResolver itself from this method; this may result in infinite
// recursions.</strong>
// @param desc The description of the Grammar being requested.
// @return the Grammar corresponding to this description or null if
// no such Grammar is known.
public Grammar retrieveGrammar(XMLGrammarDescription desc);
} // XMLGrammarPool
1.1 xml-xerces/java/src/org/apache/xerces/xni/grammars/XMLGrammarDescription.java
Index: XMLGrammarDescription.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.xerces.xni.grammars;
import org.apache.xerces.xni.XMLResourceIdentifier;
/*
* <p> This interface describes basic attributes of XML grammars--their
* physical location and their type. </p>
*
* @author Neil Graham, IBM
* @version $Id: XMLGrammarDescription.java,v 1.1 2002/01/17 23:54:59 neilg Exp $
*/
public interface XMLGrammarDescription
extends XMLResourceIdentifier {
// the type of the grammar (e.g., DTD or XSD);
// @see org.apache.xerces.xni.grammars.Grammar
public String getGrammarType();
} // XMLGrammarDescription
1.1 xml-xerces/java/src/org/apache/xerces/xni/grammars/Grammar.java
Index: Grammar.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2000-2002 The Apache Software Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.xerces.xni.grammars;
/**
* A generic grammar for use in validating XML documents. The Grammar
* object stores the validation information in a compiled form. Specific
* subclasses extend this class and "populate" the grammar by compiling
* the specific syntax (DTD, Schema, etc) into the data structures used
* by this object.
* <p>
* <strong>Note:</strong> The Grammar object is not useful as a generic
* grammar access or query object. In other words, you cannot round-trip
* specific grammar syntaxes with the compiled grammar information in
* the Grammar object. You <em>can</em> create equivalent validation
* rules in your choice of grammar syntax but there is no guarantee that
* the input and output will be the same.
*
* <p> Right now, this class is largely a shell; eventually,
* it will be enriched by having more expressive methods added. </p>
* will be moved from dtd.Grammar here.
*
* @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
* @author Jeffrey Rodriguez, IBM
* @author Eric Ye, IBM
* @author Andy Clark, IBM
* @author Neil Graham, IBM
*
* @version $Id: Grammar.java,v 1.1 2002/01/17 23:54:59 neilg Exp $
*/
public interface Grammar {
// initial set of grammar constants that some configurations will recognize;user
// components which create and/or recognize other types of grammars may
// certainly use their own constants in place of these (so long as
// their Grammar objects implement this interface).
public static final String XML_SCHEMA = "XSD";
public static final String XML_DTD = "DTD";
// return the type of this grammar
public String getGrammarType();
} // interface Grammar
1.1 xml-xerces/java/src/org/apache/xerces/xni/XMLResourceIdentifier.java
Index: XMLResourceIdentifier.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.xerces.xni;
/*
* <p> This represents the basic physical description of the location of any
* XML resource (a Schema grammar, a DTD, a general entity etc.) </p>
*
* @author Neil Graham, IBM
* @version $Id: XMLResourceIdentifier.java,v 1.1 2002/01/17 23:54:59 neilg Exp $
*/
public interface XMLResourceIdentifier {
/** Returns the public identifier. */
public String getPublicId();
/** Returns the expanded system identifier. */
public String getExpandedSystemId();
/** Returns the literal system identifier. */
public String getLiteralSystemId();
/** <p> Returns the base URI against which the literal SystemId is to be
resolved. </p> */
public String getBaseSystemId();
} // XMLResourceIdentifier
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org