You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by je...@locus.apache.org on 2000/11/23 01:11:06 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes IDDatatypeValidator.java IDREFDatatypeValidator.java
jeffreyr 00/11/22 16:11:06
Modified: java/src/org/apache/xerces/impl Tag: xerces_j_2
XMLValidator.java
java/src/org/apache/xerces/impl/validation/datatypes Tag:
xerces_j_2 IDDatatypeValidator.java
IDREFDatatypeValidator.java
Log:
table of IDs should be owned by XMLValidator
Revision Changes Path
No revision
No revision
1.1.2.38 +12 -22 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.37
retrieving revision 1.1.2.38
diff -u -r1.1.2.37 -r1.1.2.38
--- XMLValidator.java 2000/11/21 21:54:49 1.1.2.37
+++ XMLValidator.java 2000/11/23 00:11:04 1.1.2.38
@@ -104,7 +104,7 @@
* @author Andy Clark, IBM
* @author Jeffrey Rodriguez IBM
*
- * @version $Id: XMLValidator.java,v 1.1.2.37 2000/11/21 21:54:49 jeffreyr Exp $
+ * @version $Id: XMLValidator.java,v 1.1.2.38 2000/11/23 00:11:04 jeffreyr Exp $
*/
public class XMLValidator
implements XMLComponent,
@@ -249,9 +249,10 @@
private DatatypeValidator fValNOTATION;
*/
- private Hashtable fTableOfIDs = new Hashtable();//There is one per instance of XMLValidator
+ private Hashtable fTableOfIDs; //This table has to be own by instance of XMLValidator and shared among ID, IDREF and IDREFS
+ //Only ID has read/write access
+ //Should revisit and replace with a ligther structure
-
/** DEBUG flags */
private boolean DEBUG_ATTRIBUTES;
private boolean DEBUG_ELEMENT_CHILDREN;
@@ -760,7 +761,7 @@
if (fValidation) {
try {
- fValIDRef.validate();
+ fValIDRef.validate();//Do final validation of IDREFS against IDs
fValIDRefs.validate();
} catch (InvalidDatatypeValueException ex) {
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
@@ -770,12 +771,8 @@
XMLErrorReporter.SEVERITY_ERROR);
}
}
-
- fTableOfIDs.clear();
- fValID.initialize( null);
- fValIDRef.initialize(null);
- fValIDRefs.initialize(null);
+ fTableOfIDs.clear();//Clear table of IDs
return;
}
@@ -1765,7 +1762,6 @@
switch (attributeDecl.simpleType.type) {
case XMLSimpleType.TYPE_ENTITY:
-
{
boolean isAlistAttribute = attributeDecl.simpleType.list;//Caveat - Save this information because invalidStandaloneAttDef
String unTrimValue = attValue;
@@ -1842,13 +1838,7 @@
}
}
try {
- //this.fIdDefs = (Hashtable) fValID.validate( value, null );
- //System.out.println("this.fIdDefs = " + this.fIdDefs );
-
- fValIDRef.validate( value, null );
-
- //this.fStoreIDRef.setDatatypeObject( fValID.validate( value, null ) );
- //fValIDRef.validate( value, this.fStoreIDRef ); //just in case we called id after IDREF
+ fValID.validate( value, null );
} catch (InvalidDatatypeValueException ex) {
/*
reportRecoverableXMLError(ex.getMajorCode(),
@@ -1867,7 +1857,7 @@
String unTrimValue = attValue;
String value = unTrimValue.trim();
boolean isAlistAttribute = attributeDecl.simpleType.list;//Caveat - Save this information because invalidStandaloneAttDef
- //changes fTempAttDef
+
if (fValidation) {
if (value != unTrimValue) {
if (invalidStandaloneAttDef(element, attributeDecl.name)) {
@@ -1882,10 +1872,8 @@
try {
if (isAlistAttribute) {
fValIDRefs.validate(value, null );
- //fValIDRefs.validate( value, this.fStoreIDRef );
} else {
fValIDRef.validate(value, null );
- //fValIDRef.validate( value, this.fStoreIDRef );
}
} catch (InvalidDatatypeValueException ex) {
if (ex.getMajorCode() != 1 && ex.getMinorCode() != -1) {
@@ -2367,8 +2355,10 @@
*/
- //Initialize ENTITY & ENTITIES Validatorh
-
+ //Initialize ID, IDREF, IDREFS, ENTITY & ENTITIES Validators
+ if( fTableOfIDs == null ){
+ fTableOfIDs = new Hashtable();//Initialize table of IDs
+ }
fValID.initialize(fTableOfIDs);
fValIDRef.initialize(fTableOfIDs);
fValIDRefs.initialize(fTableOfIDs);
No revision
No revision
1.1.2.8 +2 -13 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/Attic/IDDatatypeValidator.java
Index: IDDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/Attic/IDDatatypeValidator.java,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -r1.1.2.7 -r1.1.2.8
--- IDDatatypeValidator.java 2000/11/10 03:00:37 1.1.2.7
+++ IDDatatypeValidator.java 2000/11/23 00:11:05 1.1.2.8
@@ -126,7 +126,7 @@
* </CODE>
*
* @author Jeffrey Rodriguez
- * @version $Id: IDDatatypeValidator.java,v 1.1.2.7 2000/11/10 03:00:37 jeffreyr Exp $
+ * @version $Id: IDDatatypeValidator.java,v 1.1.2.8 2000/11/23 00:11:05 jeffreyr Exp $
* @see org.apache.xerces.impl.validation.datatypes.AbstractDatatypeValidator
* @see org.apache.xerces.impl.validation.DatatypeValidator
* @see org.apache.xerces.impl.validation.datatypes.IDREFDatatypeValidator
@@ -195,13 +195,7 @@
* @param state This is a dummy parameter.
*/
public void initialize( Object tableOfIDs) {
- //System.out.println("IDDatatypeValidator Initialized" );
fTableOfId = (Hashtable) tableOfIDs;
- if (this.fTableOfId != null) {
- this.fTableOfId.clear();
- } else {
- this.fTableOfId = new Hashtable();
- }
}
/**
@@ -260,17 +254,12 @@
* then validate method throws a validation exception.
*/
private boolean addId(String content) {
- //System.out.println("Added ID = " + content );
- if (fTableOfId == null) {
- fTableOfId = new Hashtable();//Gain reference to table
- } else if (this.fTableOfId.containsKey( content )) {
- //System.out.println("ID - it already has this key =" + content +"table = " + this.fTableOfId );
+ if (fTableOfId.containsKey( content ) == true ) {
return false;
}
if (this.fNullValue == null) {
fNullValue = new Object();
}
- //System.out.println("Before putting content" + content );
try {
fTableOfId.put( content, fNullValue );
} catch (Exception ex) {
1.1.2.7 +4 -6 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/Attic/IDREFDatatypeValidator.java
Index: IDREFDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/Attic/IDREFDatatypeValidator.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- IDREFDatatypeValidator.java 2000/11/10 03:00:37 1.1.2.6
+++ IDREFDatatypeValidator.java 2000/11/23 00:11:05 1.1.2.7
@@ -104,7 +104,7 @@
* </CODE>
*
* @author Jeffrey Rodriguez-
- * @version $Id: IDREFDatatypeValidator.java,v 1.1.2.6 2000/11/10 03:00:37 jeffreyr Exp $
+ * @version $Id: IDREFDatatypeValidator.java,v 1.1.2.7 2000/11/23 00:11:05 jeffreyr Exp $
* @see org.apache.xerces.impl.validation.datatypes.IDDatatypeValidator
* @see org.apache.xerces.impl.validation.datatypes.AbstractDatatypeValidator
* @see org.apache.xerces.impl.validation.DatatypeValidator
@@ -153,7 +153,6 @@
InvalidDatatypeValueException error = new InvalidDatatypeValueException( "IDREF is not valid" );//Need Message
throw error;//Need Message
}
- //System.out.println("Content REF = " + content );
addIdRef( content, state);// We are storing IDs
}
@@ -195,13 +194,13 @@
*/
public void initialize( Object tableOfIDs ){
//System.out.println("IDREF datatype initialized" );
-
+
if ( this.fTableIDRefs != null) {
this.fTableIDRefs.clear();
} else {
- this.fTableIDRefs = new Hashtable();
+ this.fTableIDRefs = new Hashtable();
}
- this.fTableOfId = (Hashtable) tableOfIDs; //set reference to table of Ids.
+ fTableOfId = (Hashtable) tableOfIDs; //set reference to table of Ids.
}
@@ -269,7 +268,6 @@
* @exception InvalidDatatypeValueException
*/
private void checkIdRefs() throws InvalidDatatypeValueException {
-
if ( fTableIDRefs == null)
return;