Return-Path: Delivered-To: apmail-xml-xerces-j-dev-archive@www.apache.org Received: (qmail 4713 invoked from network); 14 Sep 2004 21:24:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 14 Sep 2004 21:24:48 -0000 Received: (qmail 31572 invoked by uid 500); 14 Sep 2004 21:24:45 -0000 Delivered-To: apmail-xml-xerces-j-dev-archive@xml.apache.org Received: (qmail 31453 invoked by uid 500); 14 Sep 2004 21:24:44 -0000 Mailing-List: contact xerces-j-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: xerces-j-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list xerces-j-dev@xml.apache.org Received: (qmail 31427 invoked by uid 99); 14 Sep 2004 21:24:43 -0000 X-ASF-Spam-Status: No, hits=0.3 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_30_40,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [32.97.182.102] (HELO e2.ny.us.ibm.com) (32.97.182.102) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 14 Sep 2004 14:24:42 -0700 Received: from northrelay04.pok.ibm.com (northrelay04.pok.ibm.com [9.56.224.206]) by e2.ny.us.ibm.com (8.12.10/8.12.9) with ESMTP id i8ELOc7J485792 for ; Tue, 14 Sep 2004 17:24:39 -0400 Received: from d25ml04.torolab.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by northrelay04.pok.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id i8ELPqvO084864 for ; Tue, 14 Sep 2004 17:25:52 -0400 To: xerces-j-dev@xml.apache.org Subject: Schema 1.1 patch MIME-Version: 1.0 X-Mailer: Lotus Notes Build V70_M2_07222004 Beta 2NP July 22, 2004 From: Ankit Pasricha Message-ID: Date: Tue, 14 Sep 2004 16:40:36 -0400 X-MIMETrack: Serialize by Router on D25ML04/25/M/IBM(Release 6.0.2CF1|June 9, 2003) at 09/14/2004 17:24:38 Content-Type: multipart/mixed; boundary="=_mixed 007175D885256F0F_=" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --=_mixed 007175D885256F0F_= Content-Type: multipart/alternative; boundary="=_alternative 007175D885256F0F_=" --=_alternative 007175D885256F0F_= Content-Type: text/plain; charset="US-ASCII" This patch adds support for 2 new duration data types, adds new build targets for schema 1.1 and provides interfaces for data types like float, double, hexbinary etc. Ankit Pasricha XML Parser Development IBM Toronto Lab 8200 Warden Avenue, Ontario L6G 1C7 Phone: (905) 413 4941 --=_alternative 007175D885256F0F_= Content-Type: text/html; charset="US-ASCII"
This patch adds support for 2 new duration data types, adds new build targets for schema 1.1
and provides interfaces for data types like float, double, hexbinary etc.



Ankit Pasricha
XML Parser Development
IBM Toronto Lab
8200 Warden Avenue, Ontario L6G 1C7
Phone: (905) 413 4941
--=_alternative 007175D885256F0F_=-- --=_mixed 007175D885256F0F_= Content-Type: text/plain; name="xml-schema-11-patch.txt" Content-Disposition: attachment; filename="xml-schema-11-patch.txt" Content-Transfer-Encoding: quoted-printable Index: build.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/xml-xerces/java/build.xml,v retrieving revision 1.171 diff -u -r1.171 build.xml --- build.xml 23 Jul 2004 20:02:28 -0000 1.171 +++ build.xml 13 Sep 2004 21:35:53 -0000 @@ -1471,4 +1471,69 @@ =20 + + + + + + + + + + + + + + + + + + + =20 + + + + + + + =09 + + + + + + + + + + + Index: src/org/apache/xerces/impl/Constants.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/Consta= nts.java,v retrieving revision 1.42 diff -u -r1.42 Constants.java --- src/org/apache/xerces/impl/Constants.java 25 Apr 2004 02:08:53 -0000 1.= 42 +++ src/org/apache/xerces/impl/Constants.java 13 Sep 2004 21:35:53 -0000 @@ -379,6 +379,9 @@ // XML version constants=20 public final static short XML=5FVERSION=5F1=5F0 =3D 1; public final static short XML=5FVERSION=5F1=5F1 =3D 2; + =20 + // Constant to enable Schema 1.1 support + public final static boolean SCHEMA=5F1=5F1=5FSUPPORT =3D false; =20 // private =20 Index: src/org/apache/xerces/impl/dv/xs/Base64BinaryDV.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/= Base64BinaryDV.java,v retrieving revision 1.5 diff -u -r1.5 Base64BinaryDV.java --- src/org/apache/xerces/impl/dv/xs/Base64BinaryDV.java 24 Feb 2004 22:44:= 24 -0000 1.5 +++ src/org/apache/xerces/impl/dv/xs/Base64BinaryDV.java 13 Sep 2004 21:35:= 53 -0000 @@ -19,6 +19,7 @@ import org.apache.xerces.impl.dv.InvalidDatatypeValueException; import org.apache.xerces.impl.dv.ValidationContext; import org.apache.xerces.impl.dv.util.Base64; +import org.apache.xerces.impl.dv.util.ByteListImpl; =20 /** * Represent the schema type "base64Binary" @@ -44,19 +45,16 @@ =20 // length of a binary type is the number of bytes public int getDataLength(Object value) { - return ((XBase64)value).length(); + return ((XBase64)value).getLength(); } =20 /** * represent base64 data */ - private static final class XBase64 { - // actually data stored in a byte array - final byte[] data; - // canonical representation of the data - private String canonical; + private static final class XBase64 extends ByteListImpl { + public XBase64(byte[] data) { - this.data =3D data; + super(data); } public synchronized String toString() { if (canonical =3D=3D null) { @@ -64,9 +62,7 @@ } return canonical; } - public int length() { - return data.length; - } + =20 public boolean equals(Object obj) { if (!(obj instanceof XBase64)) return false; Index: src/org/apache/xerces/impl/dv/xs/DoubleDV.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/= DoubleDV.java,v retrieving revision 1.7 diff -u -r1.7 DoubleDV.java --- src/org/apache/xerces/impl/dv/xs/DoubleDV.java 24 Feb 2004 22:44:24 -00= 00 1.7 +++ src/org/apache/xerces/impl/dv/xs/DoubleDV.java 13 Sep 2004 21:35:53 -00= 00 @@ -18,6 +18,7 @@ =20 import org.apache.xerces.impl.dv.InvalidDatatypeValueException; import org.apache.xerces.impl.dv.ValidationContext; +import org.apache.xerces.xs.datatypes.XSDouble; =20 /** * Represent the schema type "double" @@ -47,7 +48,7 @@ return ((XDouble)value1).compareTo((XDouble)value2); }//compare() =20 - private static final class XDouble { + private static final class XDouble implements XSDouble { private double value; public XDouble(String s) throws NumberFormatException { try { @@ -196,5 +197,8 @@ } return canonical; } + public double getValue() { + return value; + } } } // class DoubleDV Index: src/org/apache/xerces/impl/dv/xs/DurationDV.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/= DurationDV.java,v retrieving revision 1.10 diff -u -r1.10 DurationDV.java --- src/org/apache/xerces/impl/dv/xs/DurationDV.java 26 Aug 2004 02:14:40 -= 0000 1.10 +++ src/org/apache/xerces/impl/dv/xs/DurationDV.java 13 Sep 2004 21:35:53 -= 0000 @@ -28,6 +28,9 @@ */ public class DurationDV extends AbstractDateTimeDV { =20 + public static final int DURATION=5FTYPE =3D 0; + public static final int YEARMONTHDURATION=5FTYPE =3D 1; + public static final int DAYTIMEDURATION=5FTYPE =3D 2; // order-relation on duration is a partial order. The dates below are = used to // for comparison of 2 durations, based on the fact that // duration x and y is x<=3Dy iff s+x<=3Ds+y @@ -42,7 +45,7 @@ =20 public Object getActualValue(String content, ValidationContext context= ) throws InvalidDatatypeValueException{ try{ - return parse(content); + return parse(content, DURATION=5FTYPE); } catch (Exception ex) { throw new InvalidDatatypeValueException("cvc-datatype-valid.1.= 2.1", new Object[]{content, "duration"}); } @@ -56,7 +59,7 @@ * @return normalized date representation * @exception SchemaDateTimeException Invalid lexical representation */ - protected DateTimeData parse(String str) throws SchemaDateTimeExceptio= n{ + protected DateTimeData parse(String str, int durationType) throws Sche= maDateTimeException{ int len =3D str.length(); DateTimeData date=3D new DateTimeData(this); =20 @@ -85,9 +88,18 @@ if ( endDate =3D=3D -1 ) { endDate =3D len; } + else if(durationType =3D=3D YEARMONTHDURATION=5FTYPE) { + throw new SchemaDateTimeException(); + } + =20 //find 'Y' int end =3D indexOf (str, start, endDate, 'Y'); if ( end!=3D-1 ) { + =09 + if(durationType =3D=3D DAYTIMEDURATION=5FTYPE) { + throw new SchemaDateTimeException(); + } + =09 //scan year date.year=3Dnegate * parseInt(str,start,end); start =3D end+1; @@ -96,6 +108,11 @@ =20 end =3D indexOf (str, start, endDate, 'M'); if ( end!=3D-1 ) { + =09 + if(durationType =3D=3D DAYTIMEDURATION=5FTYPE) { + throw new SchemaDateTimeException(); + } + =09 //scan month date.month=3Dnegate * parseInt(str,start,end); start =3D end+1; @@ -104,6 +121,11 @@ =20 end =3D indexOf (str, start, endDate, 'D'); if ( end!=3D-1 ) { + =09 + if(durationType =3D=3D YEARMONTHDURATION=5FTYPE) { + throw new SchemaDateTimeException(); + } + =09 //scan day date.day=3Dnegate * parseInt(str,start,end); start =3D end+1; Index: src/org/apache/xerces/impl/dv/xs/FloatDV.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/= FloatDV.java,v retrieving revision 1.7 diff -u -r1.7 FloatDV.java --- src/org/apache/xerces/impl/dv/xs/FloatDV.java 24 Feb 2004 22:44:24 -000= 0 1.7 +++ src/org/apache/xerces/impl/dv/xs/FloatDV.java 13 Sep 2004 21:35:53 -0000 @@ -18,6 +18,7 @@ =20 import org.apache.xerces.impl.dv.InvalidDatatypeValueException; import org.apache.xerces.impl.dv.ValidationContext; +import org.apache.xerces.xs.datatypes.XSFloat; =20 /** * Represent the schema type "float" @@ -47,7 +48,8 @@ return ((XFloat)value1).compareTo((XFloat)value2); }//compare() =20 - private static final class XFloat { + private static final class XFloat implements XSFloat { + private float value; public XFloat(String s) throws NumberFormatException { try { @@ -196,5 +198,9 @@ } return canonical; } + =20 + public float getValue() { + return value; + } } } // class FloatDV Index: src/org/apache/xerces/impl/dv/xs/HexBinaryDV.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/= HexBinaryDV.java,v retrieving revision 1.5 diff -u -r1.5 HexBinaryDV.java --- src/org/apache/xerces/impl/dv/xs/HexBinaryDV.java 24 Feb 2004 22:44:24 = -0000 1.5 +++ src/org/apache/xerces/impl/dv/xs/HexBinaryDV.java 13 Sep 2004 21:35:53 = -0000 @@ -18,6 +18,7 @@ =20 import org.apache.xerces.impl.dv.InvalidDatatypeValueException; import org.apache.xerces.impl.dv.ValidationContext; +import org.apache.xerces.impl.dv.util.ByteListImpl; import org.apache.xerces.impl.dv.util.HexBin; =20 /** @@ -44,16 +45,13 @@ =20 // length of a binary type is the number of bytes public int getDataLength(Object value) { - return ((XHex)value).length(); + return ((XHex)value).getLength(); } =20 - private static final class XHex { - // actually data stored in a byte array - final byte[] data; - // canonical representation of the data - private String canonical; + private static final class XHex extends ByteListImpl { + public XHex(byte[] data) { - this.data =3D data; + super(data); } public synchronized String toString() { if (canonical =3D=3D null) { @@ -61,9 +59,7 @@ } return canonical; } - public int length() { - return data.length; - } + =20 public boolean equals(Object obj) { if (!(obj instanceof XHex)) return false; @@ -77,5 +73,6 @@ } return true; } + } } Index: src/org/apache/xerces/impl/dv/xs/ListDV.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/= ListDV.java,v retrieving revision 1.6 diff -u -r1.6 ListDV.java --- src/org/apache/xerces/impl/dv/xs/ListDV.java 24 Feb 2004 22:44:24 -0000= 1.6 +++ src/org/apache/xerces/impl/dv/xs/ListDV.java 13 Sep 2004 21:35:53 -0000 @@ -18,6 +18,8 @@ =20 import org.apache.xerces.impl.dv.InvalidDatatypeValueException; import org.apache.xerces.impl.dv.ValidationContext; +import org.apache.xerces.xs.XSException; +import org.apache.xerces.xs.datatypes.ObjectList; =20 /** * Represent the schema list types @@ -41,10 +43,10 @@ =20 // length of a list type is the number of items in the list public int getDataLength(Object value) { - return ((ListData)value).length(); + return ((ListData)value).getLength(); } =20 - final static class ListData { + final static class ListData implements ObjectList { final Object[] data; private String canonical; public ListData(Object[] data) { @@ -65,12 +67,9 @@ } return canonical; } - public int length() { + public int getLength() { return data.length; } - public Object item(int index) { - return data[index]; - } public boolean equals(Object obj) { if (!(obj instanceof ListData)) return false; @@ -87,6 +86,20 @@ =20 //everything went fine. return true; + } + =20 + public boolean contains(Object item) { + for(int i =3D 0;i < data.length; i++) { + if(item =3D=3D data[i]) + return true; + } + return false; + } + =20 + public Object item(int index) throws XSException { + if(index < 0 || index > data.length - 1)=20 + throw new XSException(XSException.INDEX=5FSIZE=5FERR, null); + return data[index]; } } } // class ListDV Index: src/org/apache/xerces/impl/dv/xs/SchemaDVFactoryImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/= SchemaDVFactoryImpl.java,v retrieving revision 1.15 diff -u -r1.15 SchemaDVFactoryImpl.java --- src/org/apache/xerces/impl/dv/xs/SchemaDVFactoryImpl.java 24 Feb 2004 2= 2:44:24 -0000 1.15 +++ src/org/apache/xerces/impl/dv/xs/SchemaDVFactoryImpl.java 13 Sep 2004 2= 1:35:54 -0000 @@ -16,13 +16,14 @@ =20 package org.apache.xerces.impl.dv.xs; =20 +import org.apache.xerces.impl.Constants; import org.apache.xerces.impl.dv.SchemaDVFactory; -import org.apache.xerces.impl.dv.XSSimpleType; import org.apache.xerces.impl.dv.XSFacets; +import org.apache.xerces.impl.dv.XSSimpleType; import org.apache.xerces.impl.xs.XSDeclarationPool; +import org.apache.xerces.util.SymbolHash; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSObjectList; -import org.apache.xerces.util.SymbolHash; =20 /** * the factory to create/return built-in schema DVs and create user-define= d DVs @@ -183,6 +184,8 @@ final String UNSIGNEDSHORT =3D "unsignedShort"; final String YEAR =3D "gYear"; final String YEARMONTH =3D "gYearMonth"; + final String YEARMONTHDURATION =3D "yearMonthDuration"; + final String DAYTIMEDURATION =3D "dayTimeDuration"; =20 final XSFacets facets =3D new XSFacets(); =20 @@ -197,7 +200,15 @@ =20 fBuiltInTypes.put(ANYURI, new XSSimpleTypeDecl(anySimpleType, ANYU= RI, XSSimpleTypeDecl.DV=5FANYURI, XSSimpleType.ORDERED=5FFALSE, false, fals= e, false, true, XSConstants.ANYURI=5FDT)); fBuiltInTypes.put(BASE64BINARY, new XSSimpleTypeDecl(anySimpleType= , BASE64BINARY, XSSimpleTypeDecl.DV=5FBASE64BINARY, XSSimpleType.ORDERED=5F= FALSE, false, false, false, true, XSConstants.BASE64BINARY=5FDT)); - fBuiltInTypes.put(DURATION, new XSSimpleTypeDecl(anySimpleType, DU= RATION, XSSimpleTypeDecl.DV=5FDURATION, XSSimpleType.ORDERED=5FPARTIAL, fal= se, false, false, true, XSConstants.DURATION=5FDT)); + =20 + XSSimpleTypeDecl durationDV =3D new XSSimpleTypeDecl(anySimpleType= , DURATION, XSSimpleTypeDecl.DV=5FDURATION, XSSimpleType.ORDERED=5FPARTIAL,= false, false, false, true, XSConstants.DURATION=5FDT); + fBuiltInTypes.put(DURATION, durationDV); + =20 + if(Constants.SCHEMA=5F1=5F1=5FSUPPORT) { + fBuiltInTypes.put(YEARMONTHDURATION, new XSSimpleTypeDecl(duratio= nDV, YEARMONTHDURATION, XSSimpleTypeDecl.DV=5FYEARMONTHDURATION, XSSimpleTy= pe.ORDERED=5FPARTIAL, false, false, false, true, XSConstants.YEARMONTHDURAT= ION=5FDT)); + fBuiltInTypes.put(DAYTIMEDURATION, new XSSimpleTypeDecl(durationD= V, DAYTIMEDURATION, XSSimpleTypeDecl.DV=5FDAYTIMEDURATION, XSSimpleType.ORD= ERED=5FPARTIAL, false, false, false, true, XSConstants.DAYTIMEDURATION=5FDT= )); + } + =20 fBuiltInTypes.put(DATETIME, new XSSimpleTypeDecl(anySimpleType, DA= TETIME, XSSimpleTypeDecl.DV=5FDATETIME, XSSimpleType.ORDERED=5FPARTIAL, fal= se, false, false, true, XSConstants.DATETIME=5FDT)); fBuiltInTypes.put(TIME, new XSSimpleTypeDecl(anySimpleType, TIME, = XSSimpleTypeDecl.DV=5FTIME, XSSimpleType.ORDERED=5FPARTIAL, false, false, f= alse, true, XSConstants.TIME=5FDT)); fBuiltInTypes.put(DATE, new XSSimpleTypeDecl(anySimpleType, DATE, = XSSimpleTypeDecl.DV=5FDATE, XSSimpleType.ORDERED=5FPARTIAL, false, false, f= alse, true, XSConstants.DATE=5FDT)); Index: src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/= XSSimpleTypeDecl.java,v retrieving revision 1.52 diff -u -r1.52 XSSimpleTypeDecl.java --- src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java 19 May 2004 14:0= 5:04 -0000 1.52 +++ src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java 13 Sep 2004 21:3= 5:54 -0000 @@ -77,6 +77,8 @@ static final short DV=5FINTEGER =3D DV=5FNOTATION + 4; static final short DV=5FLIST =3D DV=5FNOTATION + 5; static final short DV=5FUNION =3D DV=5FNOTATION + 6; + static final short DV=5FYEARMONTHDURATION =3D DV=5FNOTATION + 7; + static final short DV=5FDAYTIMEDURATION =3D DV=5FNOTATION + 8; =20 static final TypeValidator[] fDVs =3D { new AnySimpleDV(), @@ -104,7 +106,9 @@ new EntityDV(), new IntegerDV(), new ListDV(), - new UnionDV() + new UnionDV(), + new YearMonthDurationDV(), + new DayTimeDurationDV() }; =20 static final short NORMALIZE=5FNONE =3D 0; @@ -136,7 +140,9 @@ NORMALIZE=5FTRIM, //EntityDV(), NORMALIZE=5FTRIM, //IntegerDV(), NORMALIZE=5FFULL, //ListDV(), - NORMALIZE=5FNONE, //UnionDV() + NORMALIZE=5FNONE, //UnionDV(), + NORMALIZE=5FTRIM, //YearMonthDurationDV() + NORMALIZE=5FTRIM, //DayTimeDurationDV() }; =20 static final short SPECIAL=5FPATTERN=5FNONE =3D 0; @@ -260,7 +266,7 @@ // default constructor public XSSimpleTypeDecl(){} =20 - //Create a new built-in primitive types (and id/idref/entity/integer) + //Create a new built-in primitive types (and id/idref/entity/integer/y= earMonthDuration) protected XSSimpleTypeDecl(XSSimpleTypeDecl base, String name, short v= alidateDV, short ordered, boolean bounded, boolean fin= ite, boolean numeric, boolean isImmutable, short= builtInKind) { @@ -1607,7 +1613,7 @@ } else if (fVariety =3D=3D VARIETY=5FLIST) { =20 ListDV.ListData values =3D (ListDV.ListData)ob; - int len =3D values.length(); + int len =3D values.getLength(); if (fItemType.fVariety =3D=3D VARIETY=5FUNION) { XSSimpleTypeDecl[] memberTypes =3D (XSSimpleTypeDecl[])val= idatedInfo.memberTypes; XSSimpleType memberType =3D validatedInfo.memberType; Index: src/org/apache/xerces/xs/XSConstants.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/xs/XSConsta= nts.java,v retrieving revision 1.4 diff -u -r1.4 XSConstants.java --- src/org/apache/xerces/xs/XSConstants.java 24 Feb 2004 23:15:55 -0000 1.4 +++ src/org/apache/xerces/xs/XSConstants.java 13 Sep 2004 21:35:54 -0000 @@ -316,10 +316,26 @@ /** * The type represents a list type definition. */ - public static final short LIST=5FDT =3D 44; + public static final short LIST=5FDT =3D 44; =20 + /** + * yearMonthDuration + *=20 + * The type represents a type derived from duration to + * represent a restricted duration containing only year + * and month from the duration value space. + */ + public static final short YEARMONTHDURATION=5FDT =3D 45; + /** + * dayTimeDuration + *=20 + * The type represents a type derived from duration to + * represent a restricted duration containing the day and=20 + * time portion of the duration value space. + */ + public static final short DAYTIMEDURATION=5FDT =3D 46; /** * The built-in type category is not available. */ - public static final short UNAVAILABLE=5FDT =3D 45; + public static final short UNAVAILABLE=5FDT =3D 47; =20 } Index: src/org/apache/xerces/impl/dv/util/ByteListImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: src/org/apache/xerces/impl/dv/util/ByteListImpl.java diff -N src/org/apache/xerces/impl/dv/util/ByteListImpl.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/apache/xerces/impl/dv/util/ByteListImpl.java 1 Jan 1970 00:00:0= 0 -0000 @@ -0,0 +1,80 @@ +/* + * Copyright 2001, 2002,2004 The Apache Software Foundation. + *=20 + * Licensed 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 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * 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.util; + +import org.apache.xerces.xs.datatypes.ByteList; +import org.apache.xerces.xs.XSException; + +/** + * Implementation of org.apache.xerces.xs.datatypes.ByteList. + *=20 + * @author Ankit Pasricha, IBM + */ +public class ByteListImpl implements ByteList { + + // actually data stored in a byte array + protected final byte[] data; + =20 + // canonical representation of the data + protected String canonical; + =20 + public ByteListImpl(byte[] data) { + this.data =3D data; + } + =20 + /** + * The number of bytes in the list. The range of=20 + * valid child object indices is 0 to length-1 inclusive.= =20 + */ + public int getLength() { + return data.length; + } + + /** + * Checks if the byte item is a=20 + * member of this list.=20 + * @param item byte whose presence in this list=20 + * is to be tested.=20 + * @return True if this list contains the byte=20 + * item.=20 + */ + public boolean contains(byte item) { + for(int i =3D 0;i < data.length; i++) + if(data[i] =3D=3D item) + return true; + return false; + } + + /** + * Returns the indexth item in the collection. The index = + * starts at 0.=20 + * @param index index into the collection.=20 + * @return The byte at the indexth=20 + * position in the ByteList.=20 + * @exception XSException + * INDEX=5FSIZE=5FERR: if index is greater than or equa= l to the=20 + * number of objects in the list. + */ + public byte item(int index) + throws XSException { + if(index < 0 || index > data.length - 1) { + throw new XSException(XSException.INDEX=5FSIZE=5FERR, null); + } + return data[index]; + } + =20 +} + Index: src/org/apache/xerces/impl/dv/xs/DayTimeDurationDV.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: src/org/apache/xerces/impl/dv/xs/DayTimeDurationDV.java diff -N src/org/apache/xerces/impl/dv/xs/DayTimeDurationDV.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/apache/xerces/impl/dv/xs/DayTimeDurationDV.java 1 Jan 1970 00:0= 0:00 -0000 @@ -0,0 +1,37 @@ +/* + * Copyright 2001, 2002,2004 The Apache Software Foundation. + *=20 + * Licensed 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 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * 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; + +/** + * Used to validate the type + *=20 + * @author Ankit Pasricha, IBM + */ +public class DayTimeDurationDV extends DurationDV { + =20 + public Object getActualValue(String content, ValidationContext context) + throws InvalidDatatypeValueException { + try { + return parse(content, DurationDV.DAYTIMEDURATION=5FTYPE); + }=20 + catch (Exception ex) { + throw new InvalidDatatypeValueException("cvc-datatype-valid.1.= 2.1", new Object[]{content, "dayTimeDuration"}); + } + } +} Index: src/org/apache/xerces/impl/dv/xs/YearMonthDurationDV.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: src/org/apache/xerces/impl/dv/xs/YearMonthDurationDV.java diff -N src/org/apache/xerces/impl/dv/xs/YearMonthDurationDV.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/apache/xerces/impl/dv/xs/YearMonthDurationDV.java 1 Jan 1970 00= :00:00 -0000 @@ -0,0 +1,37 @@ +/* + * Copyright 2001, 2002,2004 The Apache Software Foundation. + *=20 + * Licensed 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 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * 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; + +/** + * Used to validate the type + *=20 + * @author Ankit Pasricha, IBM + */ +public class YearMonthDurationDV extends DurationDV { + =20 + public Object getActualValue(String content, ValidationContext context) + throws InvalidDatatypeValueException { + try { + return parse(content, DurationDV.YEARMONTHDURATION=5FTYPE); + }=20 + catch (Exception ex) { + throw new InvalidDatatypeValueException("cvc-datatype-valid.1.= 2.1", new Object[]{content, "yearMonthDuration"}); + } + } +} Index: src/org/apache/xerces/xs/datatypes/ByteList.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: src/org/apache/xerces/xs/datatypes/ByteList.java diff -N src/org/apache/xerces/xs/datatypes/ByteList.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/apache/xerces/xs/datatypes/ByteList.java 1 Jan 1970 00:00:00 -0= 000 @@ -0,0 +1,56 @@ +/* + * Copyright 2001, 2002,2004 The Apache Software Foundation. + *=20 + * Licensed 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 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * 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.xs.datatypes; + +import org.apache.xerces.xs.XSException; + +/** + * EXPERIMENTAL: The ByteList is an immutable ordered collect= ion of=20 + * byte.=20 + *=20 + * @author Ankit Pasricha, IBM + */ +public interface ByteList { + + /** + * The number of bytes in the list. The range of=20 + * valid child object indices is 0 to length-1 inclusive.= =20 + */ + public int getLength(); + + /** + * Checks if the byte item is a=20 + * member of this list.=20 + * @param item byte whose presence in this list=20 + * is to be tested.=20 + * @return True if this list contains the byte=20 + * item.=20 + */ + public boolean contains(byte item); + + /** + * Returns the indexth item in the collection. The index= =20 + * starts at 0.=20 + * @param index index into the collection.=20 + * @return The byte at the indexth=20 + * position in the ByteList.=20 + * @exception XSException + * INDEX=5FSIZE=5FERR: if index is greater than or equa= l to the=20 + * number of objects in the list. + */ + public byte item(int index) throws XSException; +=09 +} Index: src/org/apache/xerces/xs/datatypes/ObjectList.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: src/org/apache/xerces/xs/datatypes/ObjectList.java diff -N src/org/apache/xerces/xs/datatypes/ObjectList.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/apache/xerces/xs/datatypes/ObjectList.java 1 Jan 1970 00:00:00 = -0000 @@ -0,0 +1,57 @@ +/* + * Copyright 2001, 2002,2004 The Apache Software Foundation. + *=20 + * Licensed 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 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * 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.xs.datatypes; + +import org.apache.xerces.xs.XSException; + +/** + * EXPERIMENTAL: The ObjectList is an immutable ordered colle= ction of=20 + * Object.=20 + *=20 + * @author Ankit Pasricha, IBM + */ +public interface ObjectList { +=09 + /** + * The number of Objects in the list. The range of=20 + * valid child object indices is 0 to length-1 inclusive.= =20 + */ + public int getLength(); + + /** + * Checks if the Object item is a=20 + * member of this list.=20 + * @param item Object whose presence in this list=20 + * is to be tested.=20 + * @return True if this list contains the Object=20 + * item.=20 + */ + public boolean contains(Object item); + + /** + * Returns the indexth item in the collection. The index= =20 + * starts at 0.=20 + * @param index index into the collection.=20 + * @return The Object at the indexth=20 + * position in the ObjectList.=20 + * @exception XSException + * INDEX=5FSIZE=5FERR: if index is greater than or equa= l to the=20 + * number of objects in the list. + */ + public Object item(int index) + throws XSException; + +} Index: src/org/apache/xerces/xs/datatypes/XSDouble.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: src/org/apache/xerces/xs/datatypes/XSDouble.java diff -N src/org/apache/xerces/xs/datatypes/XSDouble.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/apache/xerces/xs/datatypes/XSDouble.java 1 Jan 1970 00:00:00 -0= 000 @@ -0,0 +1,30 @@ +/* + * Copyright 2001, 2002,2004 The Apache Software Foundation. + *=20 + * Licensed 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 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * 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.xs.datatypes; + +/** + * EXPERIMENTAL: Interface to expose the value of the 'double' datatype. + *=20 + * @author Ankit Pasricha, IBM + */ +public interface XSDouble { +=09 + /** + * @return value + */ + public double getValue(); + +} Index: src/org/apache/xerces/xs/datatypes/XSFloat.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: src/org/apache/xerces/xs/datatypes/XSFloat.java diff -N src/org/apache/xerces/xs/datatypes/XSFloat.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/apache/xerces/xs/datatypes/XSFloat.java 1 Jan 1970 00:00:00 -00= 00 @@ -0,0 +1,30 @@ +/* + * Copyright 2001, 2002,2004 The Apache Software Foundation. + *=20 + * Licensed 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 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * 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.xs.datatypes; + +/** + * EXPERIMENTAL: Interface to expose value of the float datatype. + *=20 + * @author Ankit Pasricha, IBM + */ +public interface XSFloat { +=09 + /** + * @return value + */ + public float getValue(); + +} --=_mixed 007175D885256F0F_= Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org For additional commands, e-mail: xerces-j-dev-help@xml.apache.org --=_mixed 007175D885256F0F_=--