sandygao 2002/11/08 08:11:26
Modified: java/src/org/apache/xerces/impl/xs/traversers
XSAttributeChecker.java
Log:
1. Changed the type of "public" attributes to "xs:token", to avoid one indirection;
2. Changed the type of "version" attributes to "xs:normalizedString", as required
by erratum E1-9.
Revision Changes Path
1.21 +17 -8
xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java
Index: XSAttributeChecker.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- XSAttributeChecker.java 23 Oct 2002 22:57:05 -0000 1.20
+++ XSAttributeChecker.java 8 Nov 2002 16:11:25 -0000 1.21
@@ -230,7 +230,7 @@
protected static final int DT_MINOCCURS1 = -9;
protected static final int DT_NAMESPACE = -10;
protected static final int DT_PROCESSCONTENTS = -11;
- protected static final int DT_PUBLIC = -12;
+ protected static final int DT_NSTRING = -12;
protected static final int DT_USE = -13;
protected static final int DT_WHITESPACE = -14;
protected static final int DT_BOOLEAN = -15;
@@ -405,7 +405,7 @@
ATTIDX_PROCESSCONTENTS,
INT_ANY_STRICT);
allAttrs[ATT_PUBLIC_R] = new OneAttr(SchemaSymbols.ATT_PUBLIC,
- DT_PUBLIC,
+ DT_TOKEN,
ATTIDX_PUBLIC,
null);
allAttrs[ATT_REF_R] = new OneAttr(SchemaSymbols.ATT_REF,
@@ -461,7 +461,7 @@
ATTIDX_VALUE,
null);
allAttrs[ATT_VERSION_N] = new OneAttr(SchemaSymbols.ATT_VERSION,
- DT_TOKEN,
+ DT_NSTRING,
ATTIDX_VERSION,
null);
allAttrs[ATT_XPATH_R] = new OneAttr(SchemaSymbols.ATT_XPATH,
@@ -1484,10 +1484,19 @@
throw new InvalidDatatypeValueException("cvc-enumeration-valid",
new Object[]{value, "(lax |
skip | strict)"});
break;
- case DT_PUBLIC:
- // public = A public identifier, per ISO 8879
- // REVISIT: how to validate "public"???
- retValue = fExtraDVs[DT_TOKEN].validate(value,
schemaDoc.fValidationContext, null);
+ case DT_NSTRING:
+ StringBuffer buf = new StringBuffer(value);
+ boolean changed = false;
+ int len = value.length();
+ char ch;
+ for (int i = 0; i < len; i++) {
+ ch = buf.charAt(i);
+ if (ch == 0x9 || ch == 0xa || ch == 0xd) {
+ buf.setCharAt(i, ' ');
+ changed = true;
+ }
+ }
+ retValue = changed ? buf.toString() : value;
break;
case DT_USE:
// use = (optional | prohibited | required)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]