Author: knoaman
Date: Wed Dec 2 19:18:54 2009
New Revision: 886273
URL: http://svn.apache.org/viewvc?rev=886273&view=rev
Log:
Add support for dateTimeStamp simple type and explicitTimezone facet. Patch by
Ken Cai with minor modifications by Khaled Noaman.
Added:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java
(with props)
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java?rev=886273&r1=886272&r2=886273&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java
Wed Dec 2 19:18:54 2009
@@ -53,6 +53,11 @@
* value of whiteSpace facet.
*/
public short whiteSpace;
+
+ /**
+ * value of explicitTimezone facet.
+ */
+ public short explicitTimezone;
/**
* value of totalDigits facet.
@@ -119,6 +124,7 @@
public XSAnnotation maxExclusiveAnnotation;
public XSAnnotation minInclusiveAnnotation;
public XSAnnotation minExclusiveAnnotation;
+ public XSAnnotation explicitTimezoneAnnotation; //XML schema 1.1
// the annotations of the assertions are stored in XSAssertImpl objects
// stored in the 'assertFacets' Vector.
@@ -137,5 +143,6 @@
minInclusiveAnnotation = null;
minExclusiveAnnotation = null;
assertFacets = null;
+ explicitTimezoneAnnotation = null; //XML Schema 1.1
}
}
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java?rev=886273&r1=886272&r2=886273&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSSimpleType.java
Wed Dec 2 19:18:54 2009
@@ -45,7 +45,20 @@
public static final short WS_REPLACE = 1;
/** collapse the white spaces */
public static final short WS_COLLAPSE = 2;
-
+
+ /**
+ * constants defined for the value of 'explicitTimezone' facet.
+ * see <a href='http://www.w3.org/TR/xmlschema11-2/#rf-explicitTimezone'>
XML Schema
+ * Part 2: Datatypes </a>
+ */
+
+ // optional the explicit timezone
+ public static final short ET_OPTIONAL = 0;
+ // required the explicit timezone
+ public static final short ET_REQUIRED = 1;
+ // prohibited the explicit timezone
+ public static final short ET_PROHIBITED = 2;
+
/**
* Constant defined for the primitive built-in simple tpyes.
* see <a
href='http://www.w3.org/TR/xmlschema-2/#built-in-primitive-datatypes'>
Added:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java?rev=886273&view=auto
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java
(added)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java
Wed Dec 2 19:18:54 2009
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.impl.dv.xs;
+
+import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
+import org.apache.xerces.impl.dv.ValidationContext;
+
+/**
+ * Validator for <dateTimeStamp> datatype (W3C Schema Datatypes)
+ *
+ * @xerces.internal
+ *
+ * @version $Id$
+ */
+public class DateTimeStampDV extends DateTimeDV {
+
+ public Object getActualValue(String content, ValidationContext context)
throws InvalidDatatypeValueException {
+ try{
+ return parse(content);
+ } catch(Exception ex){
+ throw new
InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content,
"dateTimeStamp"});
+ }
+ }
+
+ protected void validateDateTime (DateTimeData data){
+ super.validateDateTime(data);
+ if (data.utc == 0)
+ throw new RuntimeException("dateTimeStamp must have timezone");
+ }
+
+}
Propchange:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java?rev=886273&r1=886272&r2=886273&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/Schema11DVFactoryImpl.java
Wed Dec 2 19:18:54 2009
@@ -45,7 +45,9 @@
final String DAYTIMEDURATION = "dayTimeDuration";
final String PRECISIONDECIMAL = "precisionDecimal";
final String ERROR = "error";
-
+ final String DATETIMESTAMP = "dateTimeStamp";
+ final String DATETIME = "dateTime";
+
createBuiltInTypes(fBuiltInTypes, XSSimpleTypeDecl.fAnyAtomicType);
// add anyAtomicType
@@ -58,7 +60,11 @@
XSSimpleTypeDecl durationDV =
(XSSimpleTypeDecl)fBuiltInTypes.get(DURATION);
fBuiltInTypes.put(YEARMONTHDURATION, new XSSimpleTypeDecl(durationDV,
YEARMONTHDURATION, XSSimpleTypeDecl.DV_YEARMONTHDURATION,
XSSimpleType.ORDERED_PARTIAL, false, false, false, true,
XSSimpleTypeDecl.YEARMONTHDURATION_DT));
fBuiltInTypes.put(DAYTIMEDURATION, new XSSimpleTypeDecl(durationDV,
DAYTIMEDURATION, XSSimpleTypeDecl.DV_DAYTIMEDURATION,
XSSimpleType.ORDERED_PARTIAL, false, false, false, true,
XSSimpleTypeDecl.DAYTIMEDURATION_DT));
-
+
+ //add dateTimeStamp
+ XSSimpleTypeDecl dateTimeDV =
(XSSimpleTypeDecl)fBuiltInTypes.get(DATETIME);
+ fBuiltInTypes.put(DATETIMESTAMP, new XSSimpleTypeDecl(dateTimeDV,
DATETIMESTAMP, XSSimpleTypeDecl.DV_DATETIMESTAMP,
XSSimpleTypeDecl.ORDERED_PARTIAL, false, false, false, true,
XSSimpleTypeDecl.DATETIMESTAMP_DT));
+
// add precision decimal
fBuiltInTypes.put(PRECISIONDECIMAL, new
XSSimpleTypeDecl(XSSimpleTypeDecl.fAnyAtomicType, PRECISIONDECIMAL,
XSSimpleTypeDecl.DV_PRECISIONDECIMAL, XSSimpleType.ORDERED_PARTIAL, false,
false, true, true, XSSimpleTypeDecl.PRECISIONDECIMAL_DT));
} //createBuiltInTypes()
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java?rev=886273&r1=886272&r2=886273&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java
Wed Dec 2 19:18:54 2009
@@ -102,4 +102,8 @@
return isDigit(ch) ? ch - '0' : -1;
}
+ public boolean hasTimeZone(Object value){
+ return false;
+ }
+
} // interface TypeValidator
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=886273&r1=886272&r2=886273&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
Wed Dec 2 19:18:54 2009
@@ -92,6 +92,7 @@
protected static final short DV_DAYTIMEDURATION = DV_NOTATION + 8;
protected static final short DV_ANYATOMICTYPE = DV_NOTATION + 9;
protected static final short DV_ERROR = DV_NOTATION + 10;
+ protected static final short DV_DATETIMESTAMP = DV_NOTATION + 11;
private static final TypeValidator[] gDVs = {
new AnySimpleDV(),
@@ -124,7 +125,8 @@
new YearMonthDurationDV(), // XML Schema 1.1 type
new DayTimeDurationDV(), // XML Schema 1.1 type
new AnyAtomicDV(), // XML Schema 1.1 type
- new ErrorDV() // XML Schema 1.1 type
+ new ErrorDV(), // XML Schema 1.1 type
+ new DateTimeStampDV() //XML Schema 1.1 type
};
static final short NORMALIZE_NONE = 0;
@@ -162,6 +164,7 @@
NORMALIZE_TRIM, //DayTimeDurationDV() (Schema 1.1)
NORMALIZE_NONE, //AnyAtomicDV() (Schema 1.1)
NORMALIZE_NONE, //ErrorDV() (Schema 1.1)
+ NORMALIZE_TRIM, //DateTimeStampDV(), (Schema 1.1)
};
static final short SPECIAL_PATTERN_NONE = 0;
@@ -177,6 +180,10 @@
"preserve", "replace", "collapse"
};
+ static final String[] ET_FACET_STRING = {
+ "optional", "required", "prohibited"
+ };
+
static final String URI_SCHEMAFORSCHEMA =
"http://www.w3.org/2001/XMLSchema";
static final String ANY_TYPE = "anyType";
@@ -186,6 +193,7 @@
public static final short PRECISIONDECIMAL_DT = 48;
public static final short ANYATOMICTYPE_DT = 49;
public static final short ERROR_DT = 50;
+ public static final short DATETIMESTAMP_DT = 51;
// DOM Level 3 TypeInfo Derivation Method constants
static final int DERIVATION_ANY = 0;
@@ -268,6 +276,7 @@
//for constraining facets
private short fWhiteSpace = 0;
+ private short fExplicitTimezone = ET_OPTIONAL; //for XML Schema 1.1
private int fLength = -1;
private int fMinLength = -1;
private int fMaxLength = -1;
@@ -302,6 +311,7 @@
public XSAnnotation maxExclusiveAnnotation;
public XSAnnotation minInclusiveAnnotation;
public XSAnnotation minExclusiveAnnotation;
+ public XSAnnotation explicitTimezoneAnnotation;
// facets as objects
private XSObjectListImpl fFacets;
@@ -406,6 +416,7 @@
fPatternType = fBase.fPatternType;
fFixedFacet = fBase.fFixedFacet;
fFacetsDefined = fBase.fFacetsDefined;
+ fExplicitTimezone = fBase.fExplicitTimezone;
// always inherit facet annotations in case applyFacets is not called.
lengthAnnotation = fBase.lengthAnnotation;
@@ -420,6 +431,7 @@
minInclusiveAnnotation = fBase.minInclusiveAnnotation;
totalDigitsAnnotation = fBase.totalDigitsAnnotation;
fractionDigitsAnnotation = fBase.fractionDigitsAnnotation;
+ explicitTimezoneAnnotation = fBase.explicitTimezoneAnnotation;
//we also set fundamental facets information in case applyFacets is
not called.
calcFundamentalFacets();
@@ -527,6 +539,7 @@
fPatternType = fBase.fPatternType;
fFixedFacet = fBase.fFixedFacet;
fFacetsDefined = fBase.fFacetsDefined;
+ fExplicitTimezone = fBase.fExplicitTimezone;
//we also set fundamental facets information in case applyFacets is
not called.
calcFundamentalFacets();
@@ -928,6 +941,19 @@
fFixedFacet |= FACET_ASSERT;
}
+ //explicitTimezone
+ if ((presentFacet & FACET_EXPLICITTIMEZONE) != 0) {
+ if ((allowedFacet & FACET_EXPLICITTIMEZONE) == 0) {
+ reportError("cos-applicable-facets", new
Object[]{"explicitTimezone", fTypeName});
+ } else {
+ fExplicitTimezone = facets.explicitTimezone;
+ explicitTimezoneAnnotation = facets.explicitTimezoneAnnotation;
+ fFacetsDefined |= FACET_EXPLICITTIMEZONE;
+ if ((fixedFacet & FACET_EXPLICITTIMEZONE) != 0)
+ fFixedFacet |= FACET_EXPLICITTIMEZONE;
+ }
+ }
+
// maxInclusive
if ((presentFacet & FACET_MAXINCLUSIVE) != 0) {
if ((allowedFacet & FACET_MAXINCLUSIVE) == 0) {
@@ -1450,6 +1476,26 @@
reportError( "whiteSpace-valid-restriction.2", new
Object[]{fTypeName});
}
}
+
+ if ((fFacetsDefined & FACET_EXPLICITTIMEZONE) != 0) {
+ if ((fBase.fFacetsDefined & FACET_EXPLICITTIMEZONE ) != 0 &&
fExplicitTimezone != fBase.fExplicitTimezone){
+ final String explicitTZStr =
explicitTimezoneValue(fExplicitTimezone);
+ final String baseExplicitTZStr =
explicitTimezoneValue(fBase.fExplicitTimezone);
+ if ((fBase.fFixedFacet & FACET_EXPLICITTIMEZONE) != 0) {
+ reportError( "FixedFacetValue", new
Object[]{"explicitTimezone", explicitTZStr, baseExplicitTZStr, fTypeName});
+ }
+ //check 4.3.16.4 error:
+ //(explicitTimezone != prohibited &&
fBase.explicitTimezone = prohibited)
+ //or (explicitTimezone != required &&
fBase.explicitTimezone = required)
+ if (fBase.fExplicitTimezone != ET_OPTIONAL) {
+ reportError("timezone-valid-restriction", new
Object[]{fTypeName, explicitTZStr, baseExplicitTZStr});
+ }
+ }
+ if ( (fValidationDV == DV_DATETIMESTAMP) && fExplicitTimezone
!= XSSimpleType.ET_REQUIRED){
+ reportError( "FixedFacetValue", new
Object[]{"explicitTimezone", explicitTimezoneValue(fExplicitTimezone),
explicitTimezoneValue(ET_REQUIRED), fTypeName});
+ }
+ }
+
}//fFacetsDefined != null
// step 4: inherit other facets from base (including fTokeyType)
@@ -1503,6 +1549,14 @@
fWhiteSpace = fBase.fWhiteSpace;
whiteSpaceAnnotation = fBase.whiteSpaceAnnotation;
}
+
+ //inherit explicitTimezone
+ if ( (fFacetsDefined & FACET_EXPLICITTIMEZONE) == 0 &&
(fBase.fFacetsDefined & FACET_EXPLICITTIMEZONE) != 0 ) {
+ fFacetsDefined |= FACET_EXPLICITTIMEZONE;
+ fExplicitTimezone = fBase.fExplicitTimezone;
+ explicitTimezoneAnnotation = fBase.explicitTimezoneAnnotation;
+ }
+
// inherit enumeration
if ((fFacetsDefined & FACET_ENUMERATION) == 0 && (fBase.fFacetsDefined
& FACET_ENUMERATION) != 0) {
fFacetsDefined |= FACET_ENUMERATION;
@@ -1763,6 +1817,22 @@
}
}
+
+ //explicitTimezone
+ if ( ( fFacetsDefined & FACET_EXPLICITTIMEZONE) !=0 ) {
+ boolean hasTimezone = fDVs[fValidationDV].hasTimeZone(ob);
+ if (hasTimezone) {
+ if (fExplicitTimezone == ET_PROHIBITED ) {
+ throw new
InvalidDatatypeValueException("cvc-explicitTimezone-valid",
+ new Object[] {content, "prohibited", fTypeName});
+ }
+ }
+ else if (fExplicitTimezone == ET_REQUIRED) {
+ throw new
InvalidDatatypeValueException("cvc-explicitTimezone-valid",
+ new Object[] {content, "required", fTypeName});
+ }
+ }
+
int compare;
//maxinclusive
@@ -2127,6 +2197,10 @@
return WS_FACET_STRING[ws];
}
+ private String explicitTimezoneValue(short et){
+ return ET_FACET_STRING[et];
+ }
+
/**
* Fundamental Facet: ordered.
*/
@@ -2238,6 +2312,8 @@
return (fMinInclusive == null)?null:fMinInclusive.toString();
case FACET_TOTALDIGITS:
return (fTotalDigits ==
-1)?null:Integer.toString(fTotalDigits);
+ case FACET_EXPLICITTIMEZONE:
+ return ET_FACET_STRING[fExplicitTimezone];
case FACET_FRACTIONDIGITS:
if (fValidationDV == DV_INTEGER) {
return "0";
@@ -3013,6 +3089,7 @@
//for constraining facets
fWhiteSpace = 0;
+ fExplicitTimezone = ET_OPTIONAL;
fLength = -1;
fMinLength = -1;
fMaxLength = -1;
@@ -3041,6 +3118,7 @@
maxExclusiveAnnotation = null;
minInclusiveAnnotation = null;
minExclusiveAnnotation = null;
+ explicitTimezoneAnnotation = null;
fPatternType = SPECIAL_PATTERN_NONE;
fAnnotations = null;
@@ -3077,7 +3155,7 @@
if (fFacets == null &&
(fFacetsDefined != 0 || fValidationDV == DV_INTEGER)) {
- XSFacetImpl[] facets = new XSFacetImpl[10];
+ XSFacetImpl[] facets = new XSFacetImpl[11];
int count = 0;
if ((fFacetsDefined & FACET_WHITESPACE) != 0) {
facets[count] =
@@ -3178,6 +3256,15 @@
minInclusiveAnnotation);
count++;
}
+ if ((fFacetsDefined & FACET_EXPLICITTIMEZONE) != 0) {
+ facets[count] =
+ new XSFacetImpl (
+ FACET_EXPLICITTIMEZONE,
+ ET_FACET_STRING[fExplicitTimezone],
+ (fFixedFacet & FACET_EXPLICITTIMEZONE) != 0,
+ explicitTimezoneAnnotation);
+ count++;
+ }
fFacets = new XSObjectListImpl(facets, count);
}
return (fFacets != null) ? fFacets : XSObjectListImpl.EMPTY_LIST;
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=886273&r1=886272&r2=886273&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
Wed Dec 2 19:18:54 2009
@@ -300,6 +300,9 @@
whiteSpace-valid-restriction.1 = whiteSpace-valid-restriction.1: In
the definition of {0}, the value ''{1}'' for the facet ''whitespace'' is
invalid, because the value for ''whitespace'' has been set to ''collapse'' in
one of the ancestor types.
whiteSpace-valid-restriction.2 = whiteSpace-valid-restriction.2: In
the definition of {0}, the value ''preserve'' for the facet ''whitespace'' is
invalid, because the value for ''whitespace'' has been set to ''replace'' in
one of the ancestor types.
+ cvc-explicitTimezone-valid = cvc-explicitTimezone-valid: Value
''{0}'' is not facet-valid with respect to explicitTimezone ''{1}'' for type
''{2}''.
+ timezone-valid-restriction = timezone-valid-restriction: In the
definition of {0}, the value ''{1}'' for the facet ''explicitTimezone'' is
invalid, because the value for ''explicitTimezone'' has been set to ''{2}'' in
one of the ancestor types.
+
#schema for Schemas
s4s-att-invalid-value = s4s-att-invalid-value: Invalid attribute value
for ''{1}'' in element ''{0}''. Recorded reason: {2}
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java?rev=886273&r1=886272&r2=886273&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java
Wed Dec 2 19:18:54 2009
@@ -66,6 +66,7 @@
public static final String ELT_DOCUMENTATION =
"documentation".intern();
public static final String ELT_ELEMENT = "element".intern();
public static final String ELT_ENUMERATION =
"enumeration".intern();
+ public static final String ELT_EXPLICITTIMEZONE =
"explicitTimezone".intern();
public static final String ELT_EXTENSION =
"extension".intern();
public static final String ELT_FIELD = "field".intern();
public static final String ELT_FRACTIONDIGITS =
"fractionDigits".intern();
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java?rev=886273&r1=886272&r2=886273&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java
Wed Dec 2 19:18:54 2009
@@ -153,6 +153,9 @@
private static final XInt INT_WS_PRESERVE =
fXIntPool.getXInt(XSSimpleType.WS_PRESERVE);
private static final XInt INT_WS_REPLACE =
fXIntPool.getXInt(XSSimpleType.WS_REPLACE);
private static final XInt INT_WS_COLLAPSE =
fXIntPool.getXInt(XSSimpleType.WS_COLLAPSE);
+ private static final XInt INT_ET_OPTION =
fXIntPool.getXInt(XSSimpleType.ET_OPTIONAL);
+ private static final XInt INT_ET_REQUIRED =
fXIntPool.getXInt(XSSimpleType.ET_REQUIRED);
+ private static final XInt INT_ET_PROHIBITED =
fXIntPool.getXInt(XSSimpleType.ET_PROHIBITED);
private static final XInt INT_UNBOUNDED =
fXIntPool.getXInt(SchemaSymbols.OCCURRENCE_UNBOUNDED);
private static final XInt INT_MODE_NONE =
fXIntPool.getXInt(XSOpenContentDecl.MODE_NONE);
private static final XInt INT_MODE_INTERLEAVE =
fXIntPool.getXInt(XSOpenContentDecl.MODE_INTERLEAVE);
@@ -170,7 +173,7 @@
// for 15 global elements
private static final Hashtable fEleAttrs11MapG = new Hashtable(31);
// for 47 local elements
- private static final Hashtable fEleAttrs11MapL = new Hashtable(97);
+ private static final Hashtable fEleAttrs11MapL = new Hashtable(102);
// used to initialize fEleAttrsMap
// step 1: all possible data types
@@ -237,6 +240,7 @@
protected static final int DT_MODE1 = -20;
protected static final int DT_NOTNAMESPACE = -21;
protected static final int DT_NOTQNAME = -22;
+ protected static final int DT_EXPLICITTIMEZONE = -24;
static {
// step 2: all possible attributes for all elements
@@ -302,6 +306,7 @@
int ATT_NOTQNAME_N = attCount++;
int ATT_TEST_XPATH_R = attCount++;
int ATT_INHERITABLE_N = attCount++;
+ int ATT_VALUE_ET_N = attCount++;
// step 3: store all these attributes in an array
OneAttr[] allAttrs = new OneAttr[attCount];
@@ -543,6 +548,10 @@
DT_BOOLEAN,
ATTIDX_INHERITABLE,
Boolean.FALSE);
+ allAttrs[ATT_VALUE_ET_N] = new
OneAttr(SchemaSymbols.ATT_VALUE,
+ DT_EXPLICITTIMEZONE,
+ ATTIDX_VALUE,
+ null);
// step 4: for each element, make a list of possible attributes
Container attrList;
@@ -1125,6 +1134,16 @@
fEleAttrs11MapL.put(SchemaSymbols.ELT_MINEXCLUSIVE, attrList);
+ // for element "explicitTimezone" - local
+ attrList = Container.getContainer(3);
+ // id = ID
+ attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
+ // value = optional | required | prohibited
+ attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_ET_N]);
+ // fixed = boolean : false
+ attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_D]);
+ // XML Schema 1.1 - same list
+ fEleAttrs11MapL.put(SchemaSymbols.ELT_EXPLICITTIMEZONE, attrList);
// XML Schema 1.1
// same components - modified representation
@@ -1541,7 +1560,7 @@
attrValues[ATTIDX_SUBSGROUP] = new Vector();
}
if (fSchemaHandler.fSchemaVersion ==
Constants.SCHEMA_VERSION_1_1) {
- StringTokenizer st = new
StringTokenizer(attrVal, " ");
+ StringTokenizer st = new
StringTokenizer(attrVal, " \n\t\r");
while (st.hasMoreTokens()) {
Object avalue =
dv.validate(st.nextToken(), schemaDoc.fValidationContext, null);
((Vector)attrValues[ATTIDX_SUBSGROUP]).addElement(avalue);
@@ -2015,8 +2034,19 @@
}
}
break;
+ case DT_EXPLICITTIMEZONE:
+ // value = optional | required | prohibited
+ if (value.equals (SchemaSymbols.ATTVAL_OPTIONAL))
+ retValue = INT_ET_OPTION;
+ else if (value.equals (SchemaSymbols.ATTVAL_REQUIRED))
+ retValue = INT_ET_REQUIRED;
+ else if (value.equals (SchemaSymbols.ATTVAL_PROHIBITED))
+ retValue = INT_ET_PROHIBITED;
+ else
+ throw new
InvalidDatatypeValueException("cvc-enumeration-valid",
+ new Object[]{value,
"(optional | required | prohibited)"});
+ break;
}
-
return retValue;
}
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java?rev=886273&r1=886272&r2=886273&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
Wed Dec 2 19:18:54 2009
@@ -557,6 +557,9 @@
else if (facet.equals(SchemaSymbols.ELT_LENGTH)) {
currentFacet = XSSimpleType.FACET_LENGTH;
}
+ else if (facet.equals(SchemaSymbols.ELT_EXPLICITTIMEZONE)){
+ currentFacet = XSSimpleType.FACET_EXPLICITTIMEZONE;
+ }
else {
break; // a non-facet
}
@@ -623,6 +626,9 @@
case XSSimpleType.FACET_LENGTH:
xsFacets.length =
((XInt)attrs[XSAttributeChecker.ATTIDX_VALUE]).intValue();
break;
+ case XSSimpleType.FACET_EXPLICITTIMEZONE:
+ xsFacets.explicitTimezone =
((XInt)attrs[XSAttributeChecker.ATTIDX_VALUE]).shortValue();
+ break;
}
Element child = DOMUtil.getFirstChildElement( content );
@@ -670,6 +676,9 @@
case XSSimpleType.FACET_LENGTH:
xsFacets.lengthAnnotation = annotation;
break;
+ case XSSimpleType.FACET_EXPLICITTIMEZONE: //XML Schema 1.1
+ xsFacets.explicitTimezoneAnnotation = annotation;
+ break;
}
if (child != null) {
reportSchemaError("s4s-elt-must-match.1", new
Object[]{facet, "(annotation?)", DOMUtil.getLocalName(child)}, child);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]