You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by sa...@apache.org on 2001/06/07 00:42:20 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/validators/datatype IDREFDatatypeValidator.java IDDatatypeValidator.java ENTITYDatatypeValidator.java DatatypeValidatorFactoryImpl.java
sandygao 01/06/06 15:42:20
Modified: java/src/org/apache/xerces/validators/datatype
IDREFDatatypeValidator.java
IDDatatypeValidator.java
ENTITYDatatypeValidator.java
DatatypeValidatorFactoryImpl.java
Log:
no message
Revision Changes Path
1.21 +39 -86 xml-xerces/java/src/org/apache/xerces/validators/datatype/IDREFDatatypeValidator.java
Index: IDREFDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/IDREFDatatypeValidator.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- IDREFDatatypeValidator.java 2001/05/30 15:38:16 1.20
+++ IDREFDatatypeValidator.java 2001/06/06 22:42:13 1.21
@@ -71,19 +71,25 @@
*
* @author Jeffrey Rodriguez-
* @author Mark Swinkles - List Validation refactoring
- * @version $Id: IDREFDatatypeValidator.java,v 1.20 2001/05/30 15:38:16 neilg Exp $
+ * @version $Id: IDREFDatatypeValidator.java,v 1.21 2001/06/06 22:42:13 sandygao Exp $
*/
public class IDREFDatatypeValidator extends StringDatatypeValidator {
private static StringDatatypeValidator fgStrValidator = null;
- private static Object fNullValue = null;
- protected static Hashtable fTableOfId = null; //This is pass to us through the state object
- private static Hashtable fTableIDRefs = null;
-
- public static final int IDREF_STORE = 0;
- public static final int IDREF_CLEAR = 1;
- public static final int IDREF_VALIDATE = 2;
+ private static Object fNullValue = new Object();
+ public static final int IDREF_VALIDATE = 0;
+ public static final int IDREF_CHECKID = 1;
+ static {
+ // make a string validator for NCName
+ if ( fgStrValidator == null ) {
+ Hashtable strFacets = new Hashtable();
+ strFacets.put(SchemaSymbols.ELT_WHITESPACE, SchemaSymbols.ATT_COLLAPSE);
+ strFacets.put(SchemaSymbols.ELT_PATTERN , "[\\i-[:]][\\c-[:]]*" );
+ fgStrValidator = new StringDatatypeValidator (null, strFacets, false);
+ }
+ }
+
public IDREFDatatypeValidator () throws InvalidDatatypeFacetException {
this( null, null, false ); // Native, No Facets defined, Restriction
}
@@ -98,14 +104,6 @@
if ( derivedByList )
return;
- // make a string validator for NCName
- if ( fgStrValidator == null ) {
- Hashtable strFacets = new Hashtable();
- strFacets.put(SchemaSymbols.ELT_WHITESPACE, SchemaSymbols.ATT_COLLAPSE);
- strFacets.put(SchemaSymbols.ELT_PATTERN , "[\\i-[:]][\\c-[:]]*" );
- fgStrValidator = new StringDatatypeValidator (null, strFacets, false);
- }
-
Vector enum = null;
if ( facets != null )
enum = (Vector)facets.get(SchemaSymbols.ELT_ENUMERATION);
@@ -146,43 +144,28 @@
* @see org.apache.xerces.validators.datatype.InvalidDatatypeValueException
*/
public Object validate(String content, Object state ) throws InvalidDatatypeValueException{
-
- if ( state!= null ) {
- StateMessageDatatype message = (StateMessageDatatype) state;
- if ( message.getDatatypeState() == IDREFDatatypeValidator.IDREF_CLEAR ) {
- if ( this.fTableOfId != null ) {
- fTableOfId.clear(); //This is pass to us through the state object
- fTableOfId = null;
- }
- if ( this.fTableIDRefs != null ) {
- fTableIDRefs.clear();
- fTableIDRefs = null;
- }
- }
- else if ( message.getDatatypeState() == IDREFDatatypeValidator.IDREF_VALIDATE ) {
- // Validate that all keyRef is a keyIds
- this.checkIdRefs();
+ StateMessageDatatype message = (StateMessageDatatype) state;
+ if (message != null && message.getDatatypeState() == IDREF_CHECKID) {
+ Object[] params = (Object[])message.getDatatypeObject();
+ checkIdRefs((Hashtable)params[0], (Hashtable)params[1]);
+ }
+ else {
+ // use StringDatatypeValidator to validate content against facets
+ super.validate(content, state);
+ // check if content is a valid NCName
+ try {
+ fgStrValidator.validate(content, null);
}
- else if ( message.getDatatypeState() == IDREFDatatypeValidator.IDREF_STORE ) {
- this.fTableOfId = (Hashtable) message.getDatatypeObject();
+ catch ( InvalidDatatypeValueException idve ) {
+ InvalidDatatypeValueException error = new InvalidDatatypeValueException( "IDREF is not valid: " + content );
+ error.setMinorCode(XMLMessages.MSG_IDREF_INVALID);
+ error.setMajorCode(XMLMessages.VC_IDREF);
+ throw error;
}
- return null;
- }
- // use StringDatatypeValidator to validate content against facets
- super.validate(content, state);
- // check if content is a valid NCName
- try {
- fgStrValidator.validate(content, null);
+ if ( message != null && message.getDatatypeState() == IDREF_VALIDATE )
+ addIdRef( content, (Hashtable)message.getDatatypeObject());
}
- catch ( InvalidDatatypeValueException idve ) {
- InvalidDatatypeValueException error = new InvalidDatatypeValueException( "IDREF is not valid: " + content );
- error.setMinorCode(XMLMessages.MSG_IDREF_INVALID);
- error.setMajorCode(XMLMessages.VC_IDREF);
- throw error;
- }
-
- addIdRef( content, state);// We are storing IDs
return null;
}
@@ -196,61 +179,31 @@
}
/** addId. */
- private void addIdRef(String content, Object state) {
- if ( this.fTableOfId != null && this.fTableOfId.containsKey( content ) ) {
+ private void addIdRef(String content, Hashtable IDREFList) {
+ if ( IDREFList.containsKey( content ) )
return;
- }
- if ( this.fTableIDRefs == null ) {
- this.fTableIDRefs = new Hashtable();
- }
- else if ( fTableIDRefs.containsKey( content ) ) {
- return;
- }
-
- if ( this.fNullValue == null ) {
- fNullValue = new Object();
- }
-
try {
- this.fTableIDRefs.put( content, fNullValue );
+ IDREFList.put( content, fNullValue );
}
catch ( OutOfMemoryError ex ) {
- System.out.println( "Out of Memory: Hashtable of ID's has " + this.fTableIDRefs.size() + " Elements" );
+ System.out.println( "Out of Memory: Hashtable of ID's has " + IDREFList.size() + " Elements" );
ex.printStackTrace();
}
} // addId(int):boolean
-
- private void checkIdRefs() throws InvalidDatatypeValueException {
- if ( this.fTableIDRefs == null )
- return;
+ private void checkIdRefs(Hashtable IDList, Hashtable IDREFList) throws InvalidDatatypeValueException {
+ Enumeration en = IDREFList.keys();
- Enumeration en = this.fTableIDRefs.keys();
-
while ( en.hasMoreElements() ) {
String key = (String)en.nextElement();
- if ( this.fTableOfId == null || ! this.fTableOfId.containsKey(key) ) {
-
+ if ( !IDList.containsKey(key) ) {
InvalidDatatypeValueException error = new InvalidDatatypeValueException( key );
error.setMinorCode(XMLMessages.MSG_ELEMENT_WITH_ID_REQUIRED);
error.setMajorCode(XMLMessages.VC_IDREF);
throw error;
}
}
-
} // checkIdRefs()
-
- protected void resetIDRefs() {
-
- if ( this.fTableOfId != null ) {
- fTableOfId.clear();
- fTableOfId = null;
- }
- if ( this.fTableIDRefs != null ) {
- fTableIDRefs.clear();
- fTableIDRefs = null;
- }
- }
}
1.21 +27 -56 xml-xerces/java/src/org/apache/xerces/validators/datatype/IDDatatypeValidator.java
Index: IDDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/IDDatatypeValidator.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- IDDatatypeValidator.java 2001/05/10 21:25:07 1.20
+++ IDDatatypeValidator.java 2001/06/06 22:42:14 1.21
@@ -70,16 +70,21 @@
* standalone code as well as plugins to the validator architecture.
* @author Jeffrey Rodriguez
* @author Mark Swinkles - List Validation refactoring
- * @version $Id: IDDatatypeValidator.java,v 1.20 2001/05/10 21:25:07 elena Exp $
+ * @version $Id: IDDatatypeValidator.java,v 1.21 2001/06/06 22:42:14 sandygao Exp $
*/
public class IDDatatypeValidator extends StringDatatypeValidator {
private static StringDatatypeValidator fgStrValidator = null;
- private static Object fNullValue = null;
- protected static Hashtable fTableOfId = null;
+ private static Object fNullValue = new Object();
- public static final int IDREF_STORE = 0;
- public static final int ID_CLEAR = 1;
-
+ static {
+ // make a string validator for NCName
+ if ( fgStrValidator == null ) {
+ Hashtable strFacets = new Hashtable();
+ strFacets.put(SchemaSymbols.ELT_WHITESPACE, SchemaSymbols.ATT_COLLAPSE);
+ strFacets.put(SchemaSymbols.ELT_PATTERN , "[\\i-[:]][\\c-[:]]*" );
+ fgStrValidator = new StringDatatypeValidator (null, strFacets, false);
+ }
+ }
public IDDatatypeValidator () throws InvalidDatatypeFacetException {
this( null, null, false ); // Native, No Facets defined, Restriction
@@ -95,14 +100,6 @@
if ( derivedByList )
return;
- // make a string validator for NCName
- if ( fgStrValidator == null ) {
- Hashtable strFacets = new Hashtable();
- strFacets.put(SchemaSymbols.ELT_WHITESPACE, SchemaSymbols.ATT_COLLAPSE);
- strFacets.put(SchemaSymbols.ELT_PATTERN , "[\\i-[:]][\\c-[:]]*" );
- fgStrValidator = new StringDatatypeValidator (null, strFacets, false);
- }
-
Vector enum = null;
if ( facets != null )
enum = (Vector)facets.get(SchemaSymbols.ELT_ENUMERATION);
@@ -140,22 +137,9 @@
* @exception InvalidDatatypeValueException
* @see org.apache.xerces.validators.datatype.InvalidDatatypeValueException
*/
- public Object validate(String content, Object IDStorage ) throws InvalidDatatypeValueException{
-
- // no validation if asked to clear ID hash table
- if ( IDStorage != null ) {
- StateMessageDatatype message = (StateMessageDatatype) IDStorage;
- if ( message.getDatatypeState() == IDDatatypeValidator.ID_CLEAR ) {
- if ( this.fTableOfId != null ) {
- this.fTableOfId.clear();
- this.fTableOfId = null;
- }
- return null;
- }
- }
-
+ public Object validate(String content, Object state ) throws InvalidDatatypeValueException{
// use StringDatatypeValidator to validate content against facets
- super.validate(content, IDStorage);
+ super.validate(content, state);
// check if content is a valid NCName
try {
@@ -168,16 +152,17 @@
throw error;
}
- if ( !addId( content, IDStorage) ) {
- InvalidDatatypeValueException error =
- new InvalidDatatypeValueException( "ID '" + content +"' has to be unique" );
- error.setMinorCode(XMLMessages.MSG_ID_NOT_UNIQUE);
- error.setMajorCode(XMLMessages.VC_ID);
- throw error;
+ if (state != null) {
+ if ( !addId( content, (Hashtable)state) ) {
+ InvalidDatatypeValueException error =
+ new InvalidDatatypeValueException( "ID '" + content +"' has to be unique" );
+ error.setMinorCode(XMLMessages.MSG_ID_NOT_UNIQUE);
+ error.setMajorCode(XMLMessages.VC_ID);
+ throw error;
+ }
}
- //Return the table of Ids
- return fTableOfId;
+ return null;
}
@@ -190,31 +175,17 @@
/** addId. */
- private boolean addId(String content, Object idTable) {
-
- if ( this.fTableOfId == null ) {
- this.fTableOfId = new Hashtable();
- }
- else if ( this.fTableOfId.containsKey( content ) ) {
+ private boolean addId(String content, Hashtable IDList) {
+ if ( IDList.containsKey( content ) )
return false;
- }
- if ( this.fNullValue == null ) {
- fNullValue = new Object();
- }
+
try {
- this.fTableOfId.put( content, fNullValue );
+ IDList.put( content, fNullValue );
}
catch ( OutOfMemoryError ex ) {
- System.out.println( "Out of Memory: Hashtable of ID's has " + this.fTableOfId.size() + " Elements" );
+ System.out.println( "Out of Memory: Hashtable of ID's has " + IDList.size() + " Elements" );
ex.printStackTrace();
}
return true;
} // addId(int):boolean
-
- protected void resetIDs() {
- if ( this.fTableOfId != null ) {
- this.fTableOfId.clear();
- this.fTableOfId = null;
- }
- }
}
1.12 +28 -47 xml-xerces/java/src/org/apache/xerces/validators/datatype/ENTITYDatatypeValidator.java
Index: ENTITYDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/ENTITYDatatypeValidator.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ENTITYDatatypeValidator.java 2001/05/31 21:13:08 1.11
+++ ENTITYDatatypeValidator.java 2001/06/06 22:42:15 1.12
@@ -62,7 +62,6 @@
import org.apache.xerces.readers.DefaultEntityHandler;
import org.apache.xerces.utils.XMLMessages;
import org.apache.xerces.utils.StringPool;
-import org.apache.xerces.validators.datatype.StateMessageDatatype;
import org.apache.xerces.validators.schema.SchemaSymbols;
@@ -105,7 +104,7 @@
*
* @author Jeffrey Rodriguez-
* @author Mark Swinkles - List Validation refactoring
- * @version $Id: ENTITYDatatypeValidator.java,v 1.11 2001/05/31 21:13:08 neilg Exp $
+ * @version $Id: ENTITYDatatypeValidator.java,v 1.12 2001/06/06 22:42:15 sandygao Exp $
* @see org.apache.xerces.validators.datatype.DatatypeValidator
* @see org.apache.xerces.validators.datatype.DatatypeValidatorFactoryImpl
* @see org.apache.xerces.validators.datatype.DatatypeValidatorFactory
@@ -113,11 +112,16 @@
*/
public class ENTITYDatatypeValidator extends StringDatatypeValidator {
private static StringDatatypeValidator fgStrValidator = null;
- private DefaultEntityHandler fEntityHandler = null;
- private StringPool fStringPool = null;
- public static final int ENTITY_INITIALIZE = 0;
-
+ static {
+ // make a string validator for NCName
+ if ( fgStrValidator == null) {
+ Hashtable strFacets = new Hashtable();
+ strFacets.put(SchemaSymbols.ELT_WHITESPACE, SchemaSymbols.ATT_COLLAPSE);
+ strFacets.put(SchemaSymbols.ELT_PATTERN , "[\\i-[:]][\\c-[:]]*" );
+ fgStrValidator = new StringDatatypeValidator (null, strFacets, false);
+ }
+ }
public ENTITYDatatypeValidator () throws InvalidDatatypeFacetException {
this( null, null, false ); // Native, No Facets defined, Restriction
@@ -133,20 +137,6 @@
if ( derivedByList )
return;
- // make a string validator for NCName
- if ( fgStrValidator == null) {
- Hashtable strFacets = new Hashtable();
- strFacets.put(SchemaSymbols.ELT_WHITESPACE, SchemaSymbols.ATT_COLLAPSE);
- strFacets.put(SchemaSymbols.ELT_PATTERN , "[\\i-[:]][\\c-[:]]*" );
- fgStrValidator = new StringDatatypeValidator (null, strFacets, false);
- }
-
- // inherit entity handler and string pool from base validator
- if (base != null) {
- this.fEntityHandler = ((ENTITYDatatypeValidator)base).fEntityHandler;
- this.fStringPool = ((ENTITYDatatypeValidator)base).fStringPool;
- }
-
Vector enum = null;
if (facets != null)
enum = (Vector)facets.get(SchemaSymbols.ELT_ENUMERATION);
@@ -186,36 +176,26 @@
* @see org.apache.xerces.validators.datatype.InvalidDatatypeValueException
*/
public Object validate(String content, Object state ) throws InvalidDatatypeValueException{
-
- StateMessageDatatype message = (StateMessageDatatype) state;
-
- if ( message!= null && message.getDatatypeState() == ENTITYDatatypeValidator.ENTITY_INITIALIZE ){
- Object[] unpackMessage = (Object[] ) message.getDatatypeObject();
- this.fEntityHandler = (DefaultEntityHandler) unpackMessage[0];
- this.fStringPool = (StringPool) unpackMessage[1];
- } else {
- if ( this.fEntityHandler == null ) {
- throw new InvalidDatatypeValueException( "ERROR: ENTITYDatatype Validator: Failed Initialization DefaultEntityHandler is null" );
- }
- if ( this.fStringPool == null ) {
- throw new InvalidDatatypeValueException( "ERROR: ENTITYDatatype Validator: Failed Initialization StrinPool is null" );
- }
+ // use StringDatatypeValidator to validate content against facets
+ super.validate(content, state);
- // use StringDatatypeValidator to validate content against facets
- super.validate(content, state);
+ // check if content is a valid NCName
+ try {
+ fgStrValidator.validate(content, null);
+ } catch (InvalidDatatypeValueException idve) {
+ InvalidDatatypeValueException error = new InvalidDatatypeValueException( "ID is not valid: " + content );
+ error.setMinorCode(XMLMessages.MSG_ENTITY_INVALID);
+ error.setMajorCode(XMLMessages.VC_ENTITY_NAME);
+ throw error;
+ }
- // check if content is a valid NCName
- try {
- fgStrValidator.validate(content, null);
- } catch (InvalidDatatypeValueException idve) {
- InvalidDatatypeValueException error = new InvalidDatatypeValueException( "ID is not valid: " + content );
- error.setMinorCode(XMLMessages.MSG_ENTITY_INVALID);
- error.setMajorCode(XMLMessages.VC_ENTITY_NAME);
- throw error;
- }
+ if (state != null) {
+ Object[] params = (Object[]) state;
+ DefaultEntityHandler entityHandler = (DefaultEntityHandler)params[0];
+ StringPool stringPool = (StringPool)params[1];
- int attValueHandle = this.fStringPool.addSymbol( content );
- if (!this.fEntityHandler.isUnparsedEntity( attValueHandle ) ) {
+ int attValueHandle = stringPool.addSymbol( content );
+ if (!entityHandler.isUnparsedEntity( attValueHandle ) ) {
InvalidDatatypeValueException error =
new InvalidDatatypeValueException( "ENTITY '"+ content +"' is not valid" );
error.setMinorCode(XMLMessages.MSG_ENTITY_INVALID );
@@ -223,6 +203,7 @@
throw error;
}
}
+
return null;
}
1.29 +26 -29 xml-xerces/java/src/org/apache/xerces/validators/datatype/DatatypeValidatorFactoryImpl.java
Index: DatatypeValidatorFactoryImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/DatatypeValidatorFactoryImpl.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- DatatypeValidatorFactoryImpl.java 2001/06/05 23:45:54 1.28
+++ DatatypeValidatorFactoryImpl.java 2001/06/06 22:42:16 1.29
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999, 2000, 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 1999, 2000, 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,7 +10,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * 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
@@ -18,7 +18,7 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * 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,
@@ -26,7 +26,7 @@
*
* 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
+ * software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
@@ -66,7 +66,7 @@
/**
- *
+ *
* This class implements a factory of datatype validators. Internally the
* DatatypeValidators are kept in three registries:<BR>
* (i) DTDRegistry - stores DTD datatype validators
@@ -87,11 +87,11 @@
* to be checked. If no validation is necessary we should not instantiate a
* DatatypeValidatorFactoryImpl.<BR>
* <BR>
- *
+ *
* @author Elena Litani
* @author Jeffrey Rodriguez
* @author Mark Swinkles - List Validation refactoring
- * @version $Id: DatatypeValidatorFactoryImpl.java,v 1.28 2001/06/05 23:45:54 elena Exp $
+ * @version $Id: DatatypeValidatorFactoryImpl.java,v 1.29 2001/06/06 22:42:16 sandygao Exp $
*/
public class DatatypeValidatorFactoryImpl implements DatatypeValidatorFactory {
@@ -121,7 +121,7 @@
}
/**
- * Initializes fDTDRegistry with (9) DTD related datatypes .
+ * Initializes fDTDRegistry with (9) DTD related datatypes .
*/
public void initializeDTDRegistry() {
@@ -156,16 +156,16 @@
/**
* Initializes fSchemaDatatypeRegistry with schema primitive and derived datatypes.
- * See W3C Schema Datatype REC.
+ * See W3C Schema Datatype REC.
* If DTD registry is not initialized yet, this method will initialize it as well.
*/
public void expandRegistryToFullSchemaSet() {
fSchemaValidation = 1;
- //Register Primitive Datatypes
+ //Register Primitive Datatypes
if ( fRegistryExpanded != 2 ) {
DatatypeValidator v;
try {
- //REVISIT: we want to create datatypes lazily
+ //REVISIT: we want to create datatypes lazily
// esspecially for the types that are not often used
//
fSchemaDatatypeRegistry.put("boolean", new BooleanDatatypeValidator() );
@@ -175,9 +175,9 @@
fSchemaDatatypeRegistry.put("hexBinary", new HexBinaryDatatypeValidator());
fSchemaDatatypeRegistry.put("base64Binary", new Base64BinaryDatatypeValidator());
fSchemaDatatypeRegistry.put("anyURI", new AnyURIDatatypeValidator());
- fSchemaDatatypeRegistry.put("QName", new QNameDatatypeValidator());
+ fSchemaDatatypeRegistry.put("QName", new QNameDatatypeValidator());
fSchemaDatatypeRegistry.put("duration", new DurationDatatypeValidator());
- fSchemaDatatypeRegistry.put("gDay", new DayDatatypeValidator());
+ fSchemaDatatypeRegistry.put("gDay", new DayDatatypeValidator());
fSchemaDatatypeRegistry.put("time", new TimeDatatypeValidator());
fSchemaDatatypeRegistry.put("dateTime", new DateTimeDatatypeValidator());
fSchemaDatatypeRegistry.put("date", new DateDatatypeValidator());
@@ -217,13 +217,13 @@
facets.clear();
facets.put(SchemaSymbols.ELT_MAXINCLUSIVE , "0" );
- createSchemaDatatypeValidator("nonPositiveInteger",
+ createSchemaDatatypeValidator("nonPositiveInteger",
getDatatypeValidator("integer"), facets, false );
facets.clear();
facets.put(SchemaSymbols.ELT_MAXINCLUSIVE , "-1" );
- createSchemaDatatypeValidator("negativeInteger",
+ createSchemaDatatypeValidator("negativeInteger",
getDatatypeValidator( "nonPositiveInteger"), facets, false );
facets.clear();
@@ -249,7 +249,7 @@
facets.clear();
facets.put(SchemaSymbols.ELT_MININCLUSIVE, "0" );
- createSchemaDatatypeValidator("nonNegativeInteger",
+ createSchemaDatatypeValidator("nonNegativeInteger",
getDatatypeValidator( "integer"), facets, false );
facets.clear();
@@ -266,7 +266,7 @@
facets.clear();
facets.put(SchemaSymbols.ELT_MAXINCLUSIVE, "65535" );
- createSchemaDatatypeValidator("unsignedShort",
+ createSchemaDatatypeValidator("unsignedShort",
getDatatypeValidator( "unsignedInt"), facets, false );
@@ -299,12 +299,9 @@
public void resetRegistry() {
fRegistry.clear();
fSchemaValidation = 0;
- //reset some Primitive datatypes - static fields
- ((IDDatatypeValidator)fDTDDatatypeRegistry.get("ID")).resetIDs();
- ((IDREFDatatypeValidator)fDTDDatatypeRegistry.get("IDREF")).resetIDRefs();
}
- public DatatypeValidator createDatatypeValidator(String typeName,
+ public DatatypeValidator createDatatypeValidator(String typeName,
DatatypeValidator base, Hashtable facets, boolean list ) throws InvalidDatatypeFacetException {
if ( base == null ) {
return null;
@@ -329,9 +326,9 @@
/**
* Searches different datatype registries depending on validation mode (schema or dtd)
- *
+ *
* @param type
- * @return
+ * @return
*/
public DatatypeValidator getDatatypeValidator(String type) {
AbstractDatatypeValidator simpleType = null;
@@ -352,26 +349,26 @@
}
- private DatatypeValidator createSchemaDatatypeValidator(String typeName,
+ private DatatypeValidator createSchemaDatatypeValidator(String typeName,
DatatypeValidator base, Hashtable facets, boolean list ) throws InvalidDatatypeFacetException {
DatatypeValidator primitive = createSchemaValidator(typeName, base, facets, list);
registerSchemaValidator(typeName, primitive);
return primitive;
}
- private DatatypeValidator createDTDDatatypeValidator(String typeName,
+ private DatatypeValidator createDTDDatatypeValidator(String typeName,
DatatypeValidator base, Hashtable facets, boolean list ) throws InvalidDatatypeFacetException {
DatatypeValidator primitive = createSchemaValidator(typeName, base, facets, list);
registerDTDValidator(typeName, primitive);
return primitive;
}
- private DatatypeValidator createSchemaValidator (String typeName,
+ private DatatypeValidator createSchemaValidator (String typeName,
DatatypeValidator base, Hashtable facets, boolean list ) throws InvalidDatatypeFacetException{
DatatypeValidator simpleType = null;
if ( list ) {
- simpleType = new ListDatatypeValidator(base, facets, list);
+ simpleType = new ListDatatypeValidator(base, facets, list);
}
else {
try {
@@ -388,7 +385,7 @@
Class validatorDef = base.getClass();
- Class [] validatorArgsClass = new Class[] {
+ Class [] validatorArgsClass = new Class[] {
org.apache.xerces.validators.datatype.DatatypeValidator.class,
java.util.Hashtable.class,
boolean.class};
@@ -423,7 +420,7 @@
- private static Object createDatatypeValidator(Constructor validatorConstructor,
+ private static Object createDatatypeValidator(Constructor validatorConstructor,
Object[] arguments) throws InvalidDatatypeFacetException {
Object validator = null;
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org