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/10/29 19:27:50 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/impl/dv/xs UnionDatatypeValidator.java
sandygao 01/10/29 10:27:50
Modified: java/src/org/apache/xerces/impl/dv/xs
UnionDatatypeValidator.java
Log:
We have to distinguish the two cases: the type is a restrictoin of another
union type, and the type is a union of another union type and other types.
A new variable is introduced to tell whether it's a restriction. This is also a
temprory solution.
Revision Changes Path
1.3 +9 -2 xml-xerces/java/src/org/apache/xerces/impl/dv/xs/UnionDatatypeValidator.java
Index: UnionDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/UnionDatatypeValidator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- UnionDatatypeValidator.java 2001/10/29 17:08:31 1.2
+++ UnionDatatypeValidator.java 2001/10/29 18:27:50 1.3
@@ -78,6 +78,9 @@
*/
public class UnionDatatypeValidator extends AbstractDatatypeValidator {
+ // REVISIT: temprory solution for the base type of union.
+ private boolean fIsRestriction = false;
+
private Vector fBaseValidators = null; // union collection of validators
private int fValidatorsSize = 0;
private Vector fEnumeration = null;
@@ -94,6 +97,7 @@
boolean derivedBy, XMLErrorReporter reporter ) {
fErrorReporter = reporter;
fBaseValidator = base;
+ fIsRestriction = true;
//facets allowed are: pattern & enumeration
try{
@@ -141,6 +145,7 @@
public UnionDatatypeValidator ( Vector base, XMLErrorReporter reporter) {
fErrorReporter = reporter;
+ fIsRestriction = false;
if ( base !=null ) {
fValidatorsSize = base.size();
fBaseValidators = base;
@@ -185,7 +190,8 @@
}
public int compare( String value1, String value2 ){
- if (fBaseValidator instanceof UnionDatatypeValidator) {
+ //if (fBaseValidator instanceof UnionDatatypeValidator) {
+ if (fIsRestriction) {
return this.fBaseValidator.compare(value1, value2);
}
//union datatype
@@ -262,7 +268,8 @@
int index = -1; //number of validators
boolean valid=false;
DatatypeValidator currentDV = null;
- if (fBaseValidator instanceof UnionDatatypeValidator) { //restriction of union datatype
+ //if (fBaseValidator instanceof UnionDatatypeValidator) { //restriction of union datatype
+ if (fIsRestriction) {
if ( (fFacetsDefined & DatatypeValidator.FACET_PATTERN ) != 0 ) {
if ( fRegex == null || fRegex.matches( content) == false )
throw new InvalidDatatypeValueException("Value '"+content+
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org