You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@apache.org on 2004/12/07 16:07:14 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl/dv/xs AbstractDateTimeDV.java XSSimpleTypeDecl.java

ankitp      2004/12/07 07:07:14

  Modified:    java/src/org/apache/xerces/impl/dv/xs
                        AbstractDateTimeDV.java XSSimpleTypeDecl.java
  Log:
  - expose timezone info
  - access to enumeration type info
  
  Revision  Changes    Path
  1.24      +13 -1     xml-xerces/java/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java
  
  Index: AbstractDateTimeDV.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- AbstractDateTimeDV.java	29 Nov 2004 18:21:45 -0000	1.23
  +++ AbstractDateTimeDV.java	7 Dec 2004 15:07:13 -0000	1.24
  @@ -872,5 +872,17 @@
           public boolean hasTimeZone() {
               return utc != 0;
           }
  +        /* (non-Javadoc)
  +         * @see org.apache.xerces.xs.datatypes.XSDateTime#getTimeZoneHr()
  +         */
  +        public int getTimeZoneHr() {
  +        	return timezoneHr;
  +        }
  +        /* (non-Javadoc)
  +         * @see org.apache.xerces.xs.datatypes.XSDateTime#getTimeZoneMin()
  +         */
  +        public int getTimeZoneMin() {
  +        	return timezoneMin;
  +        }
       }
   }
  
  
  
  1.60      +42 -3     xml-xerces/java/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
  
  Index: XSSimpleTypeDecl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- XSSimpleTypeDecl.java	8 Oct 2004 15:49:46 -0000	1.59
  +++ XSSimpleTypeDecl.java	7 Dec 2004 15:07:13 -0000	1.60
  @@ -34,7 +34,7 @@
   import org.apache.xerces.impl.xs.util.XSObjectListImpl;
   import org.apache.xerces.util.XMLChar;
   import org.apache.xerces.xni.NamespaceContext;
  -import org.apache.xerces.xs.datatypes.ObjectList;
  +import org.apache.xerces.xs.ShortList;
   import org.apache.xerces.xs.StringList;
   import org.apache.xerces.xs.XSAnnotation;
   import org.apache.xerces.xs.XSConstants;
  @@ -44,6 +44,7 @@
   import org.apache.xerces.xs.XSObjectList;
   import org.apache.xerces.xs.XSSimpleTypeDefinition;
   import org.apache.xerces.xs.XSTypeDefinition;
  +import org.apache.xerces.xs.datatypes.ObjectList;
   
   /**
    * @xerces.internal
  @@ -243,6 +244,8 @@
       private Vector fPattern;
       private Vector fPatternStr;
       private Vector fEnumeration;
  +    private short[] fEnumerationType;
  +	private ShortList fEnumerationTypeList;
       private StringList fLexicalPattern;
       private StringList fLexicalEnumeration;
       private ObjectList fActualEnumeration;
  @@ -351,6 +354,7 @@
           fPattern = fBase.fPattern;
           fPatternStr = fBase.fPatternStr;
           fEnumeration = fBase.fEnumeration;
  +        fEnumerationType = fBase.fEnumerationType;
           fWhiteSpace = fBase.fWhiteSpace;
           fMaxExclusive = fBase.fMaxExclusive;
           fMaxInclusive = fBase.fMaxInclusive;
  @@ -455,6 +459,7 @@
           fPattern = fBase.fPattern;
           fPatternStr = fBase.fPatternStr;
           fEnumeration = fBase.fEnumeration;
  +        fEnumerationType = fBase.fEnumerationType;
           fWhiteSpace = fBase.fWhiteSpace;
           fMaxExclusive = fBase.fMaxExclusive;
           fMaxInclusive = fBase.fMaxInclusive;
  @@ -787,6 +792,7 @@
               } else {
                   fEnumeration = new Vector();
                   Vector enumVals = facets.enumeration;
  +                fEnumerationType = new short[enumVals.size()];
                   Vector enumNSDecls = facets.enumNSDecls;
                   ValidationContextImpl ctx = new ValidationContextImpl(context);
                   enumerationAnnotations = facets.enumAnnotations;
  @@ -794,8 +800,10 @@
                       if (enumNSDecls != null)
                           ctx.setNSContext((NamespaceContext)enumNSDecls.elementAt(i));
                       try {
  +                    	ValidatedInfo info = this.fBase.validateWithInfo((String)enumVals.elementAt(i), ctx, tempInfo);
                           // check 4.3.5.c0 must: enumeration values from the value space of base
  -                        fEnumeration.addElement(this.fBase.validate((String)enumVals.elementAt(i), ctx, tempInfo));
  +                        fEnumeration.addElement(info.actualValue);
  +                        fEnumerationType[i] = info.actualValueType;
                       } catch (InvalidDatatypeValueException ide) {
                           reportError("enumeration-valid-restriction", new Object[]{enumVals.elementAt(i), this.getBaseType().getName()});
                       }
  @@ -1470,6 +1478,29 @@
           return ob;
   
       }
  +    
  +    /**
  +     * validate a value, and return the compiled form
  +     */
  +    public ValidatedInfo validateWithInfo(String content, ValidationContext context, ValidatedInfo validatedInfo) throws InvalidDatatypeValueException {
  +
  +        if (context == null)
  +            context = fEmptyContext;
  +
  +        if (validatedInfo == null)
  +            validatedInfo = new ValidatedInfo();
  +        else
  +            validatedInfo.memberType = null;
  +
  +        // first normalize string value, and convert it to actual value
  +        boolean needNormalize = context==null||context.needToNormalize();
  +        getActualValue(content, context, validatedInfo, needNormalize);
  +
  +        validate(context, validatedInfo);
  +
  +        return validatedInfo;
  +
  +    }
   
       /**
        * validate a value, and return the compiled form
  @@ -2079,6 +2110,13 @@
           }
           return fActualEnumeration;
       }
  +    
  +    public ShortList getEnumerationTypeList() {
  +        if (fEnumerationTypeList == null) {
  +            fEnumerationTypeList = new ShortListImpl (fEnumerationType, fEnumerationType.length);
  +        }
  +        return fEnumerationTypeList;
  +    }
   
       /**
        * A list of pattern values if it exists, otherwise an empty
  @@ -2718,6 +2756,7 @@
           fPattern = null;
           fPatternStr = null;
           fEnumeration = null;
  +        fEnumerationType = null;
           fLexicalPattern = null;
           fLexicalEnumeration = null;
           fMaxInclusive = null;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org