You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@apache.org on 2001/01/04 09:17:05 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/parsers XMLDocumentParser.java
andyc 01/01/04 00:17:05
Modified: java/src/org/apache/xerces/impl Tag: xerces_j_2
XMLValidator.java
java/src/org/apache/xerces/impl/validation Tag: xerces_j_2
Grammar.java XMLSimpleType.java
java/src/org/apache/xerces/impl/validation/datatypes Tag:
xerces_j_2 DatatypeValidatorFactoryImpl.java
java/src/org/apache/xerces/impl/validation/grammars Tag:
xerces_j_2 DTDGrammar.java
java/src/org/apache/xerces/parsers Tag: xerces_j_2
XMLDocumentParser.java
Log:
1) Fix for checking root element name against the DOCTYPE when
using Schema grammar. It just didn't make sense to check it
because you won't usually have a DOCTYPE in an XML document
that uses Schema.
2) The start of some re-working of the validation code. Before
the code would not allow you to plug in your own datatype
validator factory. The factory impl was hardcoded when it
shouldn't have been. NOTE: There is still a *lot* of work
to do on the validation architecture and implementation.
Revision Changes Path
No revision
No revision
1.1.2.61 +37 -7 xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLValidator.java
Index: XMLValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLValidator.java,v
retrieving revision 1.1.2.60
retrieving revision 1.1.2.61
diff -u -r1.1.2.60 -r1.1.2.61
--- XMLValidator.java 2000/12/28 09:41:16 1.1.2.60
+++ XMLValidator.java 2001/01/04 08:17:00 1.1.2.61
@@ -60,6 +60,7 @@
import org.apache.xerces.impl.XMLErrorReporter;
import org.apache.xerces.impl.msg.XMLMessageFormatter;
import org.apache.xerces.impl.validation.ContentModelValidator;
+import org.apache.xerces.impl.validation.DatatypeValidatorFactory;
import org.apache.xerces.impl.validation.Grammar;
import org.apache.xerces.impl.validation.GrammarPool;
import org.apache.xerces.impl.validation.XMLAttributeDecl;
@@ -106,7 +107,7 @@
* @author Andy Clark, IBM
* @author Jeffrey Rodriguez IBM
*
- * @version $Id: XMLValidator.java,v 1.1.2.60 2000/12/28 09:41:16 andyc Exp $
+ * @version $Id: XMLValidator.java,v 1.1.2.61 2001/01/04 08:17:00 andyc Exp $
*/
public class XMLValidator
implements XMLComponent,
@@ -130,6 +131,9 @@
/** fNamespaceBinder */
protected XMLNamespaceBinder fNamespaceBinder;
+ /** Datatype validator factory. */
+ protected DatatypeValidatorFactory fDatatypeValidatorFactory;
+
// features
/** fNamespaces */
@@ -239,7 +243,7 @@
/** Datatype Registry and attribute validators */
- private DatatypeValidatorFactoryImpl fDataTypeReg;
+ //private DatatypeValidatorFactoryImpl fDataTypeReg;
private IDDatatypeValidator fValID;
private IDREFDatatypeValidator fValIDRef;
private ListDatatypeValidator fValIDRefs;
@@ -327,6 +331,7 @@
fErrorReporter = (XMLErrorReporter)componentManager.getProperty(Constants.XERCES_PROPERTY_PREFIX+Constants.ERROR_REPORTER_PROPERTY);
fSymbolTable = (SymbolTable)componentManager.getProperty(Constants.XERCES_PROPERTY_PREFIX+Constants.SYMBOL_TABLE_PROPERTY);
fGrammarPool = (GrammarPool)componentManager.getProperty(Constants.XERCES_PROPERTY_PREFIX+Constants.GRAMMAR_POOL_PROPERTY);
+ fDatatypeValidatorFactory = (DatatypeValidatorFactory)componentManager.getProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_VALIDATOR_FACTORY_PROPERTY);
for (int i = 0; i < fElementQNamePartsStack.length; i++) {
fElementQNamePartsStack[i] = new QName();
@@ -1080,7 +1085,8 @@
fDTDElementDecls.removeAllElements();
// create DTD grammar
- fDTDGrammar = new DTDGrammar();
+ fDTDGrammar = createDTDGrammar();
+ fDTDGrammar.setDatatypeValidatorFactory(fDatatypeValidatorFactory);
// REVISIT: should we use the systemId as the key instead?
fGrammarPool.putGrammar("", fDTDGrammar);
@@ -1472,7 +1478,6 @@
// save grammar
fDTDGrammar.endDTD();
fCurrentGrammar = fDTDGrammar;
- fDTDGrammar = null;
// REVESIT: if schema validation is turned on, we shouldn't be doing this.
fCurrentGrammarIsDTD = true;
fCurrentGrammarIsSchema = false;
@@ -2317,7 +2322,7 @@
/** Root element specified. */
private void rootElementSpecified(QName rootElement) throws SAXException {
- if (fValidation) {
+ if (fValidation && fCurrentGrammarIsDTD) {
String root1 = fRootElement.rawname;
String root2 = rootElement.rawname;
if (root1 == null || !root1.equals(root2)) {
@@ -2534,9 +2539,10 @@
fDataTypeReg = new DatatypeValidatorFactoryImpl();
*/
+ /***
fDataTypeReg = DatatypeValidatorFactoryImpl.getDatatypeRegistry();//To be commented or deleted when no Singleton
fDataTypeReg.initializeDTDRegistry();
-
+
fValID = (IDDatatypeValidator) fDataTypeReg.getDatatypeValidator("ID" );
fValIDRef = (IDREFDatatypeValidator) fDataTypeReg.getDatatypeValidator("IDREF" );
fValIDRefs = (ListDatatypeValidator) fDataTypeReg.getDatatypeValidator("IDREFS" );
@@ -2545,7 +2551,22 @@
fValNMTOKEN = fDataTypeReg.getDatatypeValidator("NMTOKEN");
fValNMTOKENS = fDataTypeReg.getDatatypeValidator("NMTOKENS");
fValNOTATION = (NOTATIONDatatypeValidator) fDataTypeReg.getDatatypeValidator("NOTATION" );
-
+ /***/
+ try {
+ fValID = (IDDatatypeValidator)fDatatypeValidatorFactory.createDatatypeValidator("ID", null, null, false);
+ fValIDRef = (IDREFDatatypeValidator) fDatatypeValidatorFactory.createDatatypeValidator("IDREF", null, null, false);
+ fValIDRefs = (ListDatatypeValidator) fDatatypeValidatorFactory.createDatatypeValidator("IDREFS", null, null, false);
+ fValENTITY = (ENTITYDatatypeValidator) fDatatypeValidatorFactory.createDatatypeValidator("ENTITY", null, null, false);
+ fValENTITIES = (ListDatatypeValidator) fDatatypeValidatorFactory.createDatatypeValidator("ENTITIES", null, null, false);
+ fValNMTOKEN = fDatatypeValidatorFactory.createDatatypeValidator("NMTOKEN", null, null, false);
+ fValNMTOKENS = fDatatypeValidatorFactory.createDatatypeValidator("NMTOKENS", null, null, false);
+ fValNOTATION = (NOTATIONDatatypeValidator) fDatatypeValidatorFactory.createDatatypeValidator("NOTATION", null, null, false);
+ }
+ catch (Exception e) {
+ // should never happen
+ e.printStackTrace(System.err);
+ }
+ /***/
//Initialize ID, IDREF, IDREFS validators
if (fTableOfIDs == null) {
@@ -2593,5 +2614,14 @@
}
} // ensureStackCapacity
+
+ //
+ // Protected methods
+ //
+
+ /** Factory method for creating a DTD grammar. */
+ protected DTDGrammar createDTDGrammar() {
+ return new DTDGrammar();
+ } // createDTDGrammar():DTDGrammar
} // class XMLValidator
No revision
No revision
1.1.2.28 +9 -3 xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/Grammar.java
Index: Grammar.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/Grammar.java,v
retrieving revision 1.1.2.27
retrieving revision 1.1.2.28
diff -u -r1.1.2.27 -r1.1.2.28
--- Grammar.java 2000/12/30 00:24:44 1.1.2.27
+++ Grammar.java 2001/01/04 08:17:01 1.1.2.28
@@ -92,7 +92,7 @@
* @author Eric Ye, IBM
* @author Andy Clark, IBM
*
- * @version $Id: Grammar.java,v 1.1.2.27 2000/12/30 00:24:44 lehors Exp $
+ * @version $Id: Grammar.java,v 1.1.2.28 2001/01/04 08:17:01 andyc Exp $
*/
public class Grammar {
@@ -294,7 +294,9 @@
* @return
*/
public int getElementDeclIndex(String elementDeclName, int scope) {
- return fScopeMapping.get(scope, elementDeclName, null);
+ int mapping = fScopeMapping.get(scope, elementDeclName, null);
+ //System.out.println("getElementDeclIndex("+elementDeclName+','+scope+") -> "+mapping);
+ return mapping;
} // getElementDeclIndex(String,int):int
/**
@@ -306,7 +308,9 @@
* @return
*/
public int getElementDeclIndex(QName elementDeclQName, int scope) {
- return fScopeMapping.get(scope, elementDeclQName.localpart, elementDeclQName.uri);
+ int mapping = fScopeMapping.get(scope, elementDeclQName.localpart, elementDeclQName.uri);
+ //System.out.println("getElementDeclIndex("+elementDeclQName+','+scope+") -> "+mapping);
+ return mapping;
} // getElementDeclIndex(QName,int):int
/**
@@ -1733,6 +1737,8 @@
}
}
+ //System.out.println("put("+key1+','+key2+','+key3+" -> "+value+')');
+ //System.out.println("get("+key1+','+key2+','+key3+") -> "+get(key1,key2,key3));
} // put(int,String,String,int)
1.1.2.8 +2 -2 xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/XMLSimpleType.java
Index: XMLSimpleType.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/XMLSimpleType.java,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -r1.1.2.7 -r1.1.2.8
--- XMLSimpleType.java 2000/12/28 09:41:20 1.1.2.7
+++ XMLSimpleType.java 2001/01/04 08:17:02 1.1.2.8
@@ -59,7 +59,7 @@
/**
* @author Stubs generated by DesignDoc on Wed Jun 07 11:58:44 PDT 2000
- * @version $Id: XMLSimpleType.java,v 1.1.2.7 2000/12/28 09:41:20 andyc Exp $
+ * @version $Id: XMLSimpleType.java,v 1.1.2.8 2001/01/04 08:17:02 andyc Exp $
*/
public class XMLSimpleType {
@@ -111,7 +111,7 @@
public short type;
/** name */
- protected String name;
+ public String name;
/** enumeration */
public String[] enumeration;
No revision
No revision
1.1.2.12 +66 -60 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/Attic/DatatypeValidatorFactoryImpl.java
Index: DatatypeValidatorFactoryImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/Attic/DatatypeValidatorFactoryImpl.java,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -u -r1.1.2.11 -r1.1.2.12
--- DatatypeValidatorFactoryImpl.java 2000/12/02 02:14:14 1.1.2.11
+++ DatatypeValidatorFactoryImpl.java 2001/01/04 08:17:03 1.1.2.12
@@ -91,19 +91,25 @@
* If validation is needed, we need to instantiate a DatatypeValidatorFactoryImpl.<BR>
*
* @author Jeffrey Rodriguez
- * @version $Id: DatatypeValidatorFactoryImpl.java,v 1.1.2.11 2000/12/02 02:14:14 jeffreyr Exp $
+ * @version $Id: DatatypeValidatorFactoryImpl.java,v 1.1.2.12 2001/01/04 08:17:03 andyc Exp $
*/
public class DatatypeValidatorFactoryImpl implements DatatypeValidatorFactory {
private static final boolean fDebug = false;
- private Hashtable fBaseTypes = new Hashtable();
- private boolean fRegistryExpanded = false;
+ //private Hashtable fgBaseTypes = new Hashtable();
+ //private boolean fRegistryExpanded = false;
+ protected static final Hashtable fgBaseTypes = new Hashtable();
+ protected static boolean fgRegistryExpanded = false;
+ protected Hashtable fUserDefinedTypes = new Hashtable();
+
+ /***
private static DatatypeValidatorFactoryImpl fRegistryOfDatatypes =
new DatatypeValidatorFactoryImpl();//comment this in when switching to no Singleton
- private DatatypeValidatorFactoryImpl() {//this need method to change to public or deleted when change to no singleton
+ public DatatypeValidatorFactoryImpl() {
}
+ /***/
/* comment this out when change to no singleton.
public DatatypeValidatorFactoryImpl() {
@@ -115,28 +121,25 @@
public void expandRegistryToFullSchemaSet() {
- if (fBaseTypes == null) {
- fBaseTypes = new Hashtable(); // if it is null
- fRegistryExpanded = false;
- }
//Register Primitive Datatypes
- if (fRegistryExpanded == false) {
+ if (fgRegistryExpanded == false) {
+ fgRegistryExpanded = true;
DatatypeValidator v;
try {
- fBaseTypes.put("string", new StringDatatypeValidator() );
- fBaseTypes.put("boolean", new BooleanDatatypeValidator() );
- fBaseTypes.put("float", new FloatDatatypeValidator());
- fBaseTypes.put("double", new DoubleDatatypeValidator());
- fBaseTypes.put("decimal", new DecimalDatatypeValidator());
- fBaseTypes.put("timeDuration", new TimeDurationDatatypeValidator());
- fBaseTypes.put("recurringDuration", new RecurringDurationDatatypeValidator());
- fBaseTypes.put("binary", new BinaryDatatypeValidator());
- fBaseTypes.put("uriReference", new URIReferenceDatatypeValidator());
- fBaseTypes.put("ID", new IDDatatypeValidator());
- fBaseTypes.put("IDREF", new IDREFDatatypeValidator());
- fBaseTypes.put("ENTITY", new ENTITYDatatypeValidator());
- fBaseTypes.put("NOTATION", new NOTATIONDatatypeValidator());
- fBaseTypes.put("QName", new QNameDatatypeValidator());
+ fgBaseTypes.put("string", new StringDatatypeValidator() );
+ fgBaseTypes.put("boolean", new BooleanDatatypeValidator() );
+ fgBaseTypes.put("float", new FloatDatatypeValidator());
+ fgBaseTypes.put("double", new DoubleDatatypeValidator());
+ fgBaseTypes.put("decimal", new DecimalDatatypeValidator());
+ fgBaseTypes.put("timeDuration", new TimeDurationDatatypeValidator());
+ fgBaseTypes.put("recurringDuration", new RecurringDurationDatatypeValidator());
+ fgBaseTypes.put("binary", new BinaryDatatypeValidator());
+ fgBaseTypes.put("uriReference", new URIReferenceDatatypeValidator());
+ fgBaseTypes.put("ID", new IDDatatypeValidator());
+ fgBaseTypes.put("IDREF", new IDREFDatatypeValidator());
+ fgBaseTypes.put("ENTITY", new ENTITYDatatypeValidator());
+ fgBaseTypes.put("NOTATION", new NOTATIONDatatypeValidator());
+ fgBaseTypes.put("QName", new QNameDatatypeValidator());
Hashtable facets = new Hashtable();
@@ -310,22 +313,15 @@
* @param registrySet
*/
public void initializeDTDRegistry() {
-
- if (fBaseTypes == null) {
- fBaseTypes = new Hashtable();
- fRegistryExpanded = false;
- }
-
- //Register Primitive Datatypes
- if (fRegistryExpanded == false) { //Core datatypes shared by DTD attributes and Schema
+ if (fgRegistryExpanded == false) { //Core datatypes shared by DTD attributes and Schema
try {
- fBaseTypes.put("string", new StringDatatypeValidator() );
- fBaseTypes.put("ID", new IDDatatypeValidator());
- fBaseTypes.put("IDREF", new IDREFDatatypeValidator());
- fBaseTypes.put("ENTITY", new ENTITYDatatypeValidator());
- fBaseTypes.put("NOTATION", new NOTATIONDatatypeValidator());
+ fgBaseTypes.put("string", new StringDatatypeValidator() );
+ fgBaseTypes.put("ID", new IDDatatypeValidator());
+ fgBaseTypes.put("IDREF", new IDREFDatatypeValidator());
+ fgBaseTypes.put("ENTITY", new ENTITYDatatypeValidator());
+ fgBaseTypes.put("NOTATION", new NOTATIONDatatypeValidator());
createDatatypeValidator( "IDREFS", new IDREFDatatypeValidator(), null , true );
@@ -347,9 +343,9 @@
public void resetRegistry() {
- if (fBaseTypes != null) {
- fBaseTypes.clear();
- fRegistryExpanded = false;
+ if (fgBaseTypes != null) {
+ fgBaseTypes.clear();
+ fgRegistryExpanded = false;
//initializeDTDRegistry();
}
}
@@ -363,6 +359,23 @@
System.out.println("type name = " + name );
}
+ if (base == null) {
+ synchronized (DatatypeValidatorFactoryImpl.class) {
+ if (!fgBaseTypes.containsKey(name)) {
+ // lazily construct DTD base types
+ if (!fgBaseTypes.containsKey("NMTOKEN")) {
+ initializeDTDRegistry();
+ }
+ if (!fgBaseTypes.containsKey(name)) {
+ // lazily construct Schema base types
+ if (!fgBaseTypes.containsKey("boolean")) {
+ expandRegistryToFullSchemaSet();
+ }
+ }
+ }
+ }
+ base = getDatatypeValidator(name);
+ }
if (base != null) {
if (list) {
simpleType = new ListDatatypeValidator(base, facets, list);
@@ -446,23 +459,18 @@
public DatatypeValidator getDatatypeValidator(String type) {
- AbstractDatatypeValidator simpleType = null;
- if (fDebug) {
- System.out.println( "type = >" + type +"<");
- System.out.println( "fBaseTypes = >" + fBaseTypes +"<" );
- simpleType = (AbstractDatatypeValidator) fBaseTypes.get(type);
- }
- if (type != null && fBaseTypes != null
- && fBaseTypes.containsKey( type ) == true) {
- simpleType = (AbstractDatatypeValidator) fBaseTypes.get(type);
+ DatatypeValidator validator = (DatatypeValidator)fUserDefinedTypes.get(type);
+ if (validator == null) {
+ validator = (DatatypeValidator)fgBaseTypes.get(type);
}
- return(DatatypeValidator) simpleType;
+ return validator;
}
private void addValidator(String name, DatatypeValidator v) {
- fBaseTypes.put(name,v);
+ fUserDefinedTypes.put(name,v);
}
+ /***
static public DatatypeValidatorFactoryImpl getDatatypeRegistry() {
return fRegistryOfDatatypes;
@@ -470,9 +478,8 @@
static public void main( String argv[] ) {
DatatypeValidatorFactoryImpl tstRegistry = DatatypeValidatorFactoryImpl.getDatatypeRegistry();//this needs to ne commented out or deleted once we go to no singleton
- /* This needs to be commented out
- DatatypeValidatorFactoryImpl tstRegistry = new DatatypeValidatorFactoryImpl();
- */
+ // This needs to be commented out
+ //DatatypeValidatorFactoryImpl tstRegistry = new DatatypeValidatorFactoryImpl();
System.out.println("tstRegistry = " + tstRegistry );
@@ -521,14 +528,12 @@
Hashtable tst = (Hashtable)((IDDatatypeValidator) idData).getInternalStateInformation();
if (tst != null) {
System.out.println("Table of ID = " + tst.toString());
- }
- /*
- try {
- idData.validate( "a1", null );
- } catch ( Exception ex ) {
- ex.printStackTrace();// Should throw a unique exception
}
- */
+ //try {
+ // idData.validate( "a1", null );
+ //} catch ( Exception ex ) {
+ // ex.printStackTrace();// Should throw a unique exception
+ //}
}
@@ -558,6 +563,7 @@
}
}
+ /***/
}
No revision
No revision
1.1.2.35 +11 -2 xml-xerces/java/src/org/apache/xerces/impl/validation/grammars/Attic/DTDGrammar.java
Index: DTDGrammar.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/grammars/Attic/DTDGrammar.java,v
retrieving revision 1.1.2.34
retrieving revision 1.1.2.35
diff -u -r1.1.2.34 -r1.1.2.35
--- DTDGrammar.java 2000/12/28 09:41:23 1.1.2.34
+++ DTDGrammar.java 2001/01/04 08:17:04 1.1.2.35
@@ -62,6 +62,7 @@
import org.apache.xerces.impl.XMLErrorReporter;
import org.apache.xerces.impl.msg.XMLMessageFormatter;
+import org.apache.xerces.impl.validation.DatatypeValidatorFactory;
import org.apache.xerces.impl.validation.Grammar;
import org.apache.xerces.impl.validation.ContentModelValidator;
import org.apache.xerces.impl.validation.XMLElementDecl;
@@ -89,7 +90,7 @@
* @author Jeffrey Rodriguez, IBM
* @author Andy Clark, IBM
*
- * @version $Id: DTDGrammar.java,v 1.1.2.34 2000/12/28 09:41:23 andyc Exp $
+ * @version $Id: DTDGrammar.java,v 1.1.2.35 2001/01/04 08:17:04 andyc Exp $
*/
public class DTDGrammar
extends Grammar
@@ -120,6 +121,9 @@
// Data
//
+ /** Datatype validator factory. */
+ protected DatatypeValidatorFactory fDatatypeValidatorFactory;
+
/** Current element index. */
protected int fCurrentElementIndex;
@@ -210,6 +214,11 @@
// Public methods
//
+ /** Sets the datatype validator factory. */
+ public void setDatatypeValidatorFactory(DatatypeValidatorFactory factory) {
+ fDatatypeValidatorFactory = factory;
+ }
+
/**
* Returns true if the specified element declaration is external.
*
@@ -484,7 +493,7 @@
}
fSimpleType.defaultValue = defaultValue.length >= 0 ? defaultValue.toString() : null;
fSimpleType.enumeration = enumeration;
- fSimpleType.datatypeValidator = DatatypeValidatorFactoryImpl.getDatatypeRegistry().getDatatypeValidator(type);
+ fSimpleType.datatypeValidator = fDatatypeValidatorFactory.createDatatypeValidator(type, null, null, false);
if (type.equals("CDATA")) {
fSimpleType.type = XMLSimpleType.TYPE_CDATA;
No revision
No revision
1.1.2.28 +22 -3 xml-xerces/java/src/org/apache/xerces/parsers/Attic/XMLDocumentParser.java
Index: XMLDocumentParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/XMLDocumentParser.java,v
retrieving revision 1.1.2.27
retrieving revision 1.1.2.28
diff -u -r1.1.2.27 -r1.1.2.28
--- XMLDocumentParser.java 2000/12/13 01:15:13 1.1.2.27
+++ XMLDocumentParser.java 2001/01/04 08:17:04 1.1.2.28
@@ -67,7 +67,8 @@
import org.apache.xerces.impl.XMLValidator;
import org.apache.xerces.impl.validation.DatatypeValidatorFactory;
import org.apache.xerces.impl.validation.GrammarPool;
-import org.apache.xerces.impl.validation.validators.XMLDTDValidator;
+import org.apache.xerces.impl.validation.datatypes.DatatypeValidatorFactoryImpl;
+//import org.apache.xerces.impl.validation.validators.XMLDTDValidator;
import org.apache.xerces.util.SymbolTable;
import org.apache.xerces.xni.QName;
import org.apache.xerces.xni.XMLAttributes;
@@ -92,7 +93,7 @@
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
- * @version $Id: XMLDocumentParser.java,v 1.1.2.27 2000/12/13 01:15:13 lehors Exp $
+ * @version $Id: XMLDocumentParser.java,v 1.1.2.28 2001/01/04 08:17:04 andyc Exp $
*/
public abstract class XMLDocumentParser
extends XMLParser
@@ -187,10 +188,14 @@
final String DTD_SCANNER = Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_SCANNER_PROPERTY;
fProperties.put(DTD_SCANNER, fDTDScanner);
- fValidator = new XMLValidator();
+ fValidator = createValidator();
final String VALIDATOR = Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATOR_PROPERTY;
fProperties.put(VALIDATOR, fValidator);
+ fDatatypeValidatorFactory = createDatatypeValidatorFactory();
+ final String DATATYPE_VALIDATOR_FACTORY = Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_VALIDATOR_FACTORY_PROPERTY;
+ fProperties.put(DATATYPE_VALIDATOR_FACTORY, fDatatypeValidatorFactory);
+
/***
fDatatypeValidatorFactory = new DatatypeValidatorFactory();
final String DATATYE_VALIDATOR_FACTORY = Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYE_VALIDATOR_FACTORY_PROPERTY;
@@ -990,5 +995,19 @@
super.checkProperty(propertyId);
} // checkProperty(String)
+
+ //
+ // Protected methods
+ //
+
+ /** Create a validator. */
+ protected XMLValidator createValidator() {
+ return new XMLValidator();
+ } // createValidator():XMLValidator
+
+ /** Create a datatype validator factory. */
+ protected DatatypeValidatorFactory createDatatypeValidatorFactory() {
+ return new DatatypeValidatorFactoryImpl();
+ } // createDatatypeValidatorFactory():DatatypeValidatorFactory
} // class XMLDocumentParser