mrglavas    2004/10/08 08:49:47

  Modified:    java/src/org/apache/xerces/impl/dv/xs XSSimpleTypeDecl.java
  Log:
  For QNames, NOTATIONs and types derived from them you

  cannot determine actual values from the lexical form alone.

  

  Adding a method for retrieving actual enumeration values.

  This was previously impossible to derive from the current

  XSModel.

  
  Revision  Changes    Path
  1.59      +27 -1     
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.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- XSSimpleTypeDecl.java     6 Oct 2004 14:56:47 -0000       1.58
  +++ XSSimpleTypeDecl.java     8 Oct 2004 15:49:46 -0000       1.59
  @@ -34,6 +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.StringList;
   import org.apache.xerces.xs.XSAnnotation;
   import org.apache.xerces.xs.XSConstants;
  @@ -244,6 +245,7 @@
       private Vector fEnumeration;
       private StringList fLexicalPattern;
       private StringList fLexicalEnumeration;
  +    private ObjectList fActualEnumeration;
       private Object fMaxInclusive;
       private Object fMaxExclusive;
       private Object fMinExclusive;
  @@ -2052,6 +2054,30 @@
               fLexicalEnumeration = new StringListImpl(strs, size);
           }
           return fLexicalEnumeration;
  +    }
  +    
  +    /**
  +     * A list of actual enumeration values if it exists, otherwise an empty
  +     * <code>ObjectList</code>.
  +     */
  +    public ObjectList getActualEnumeration() {
  +        if (fActualEnumeration == null) {
  +            fActualEnumeration = new ObjectList () {
  +                public int getLength() {
  +                    return (fEnumeration != null) ? fEnumeration.size() : 0;
  +                }
  +                public boolean contains(Object item) {
  +                    return (fEnumeration != null && fEnumeration.contains(item));
  +                }
  +                public Object item(int index) {
  +                    if (index < 0 || index >= getLength()) {
  +                        return null;
  +                    }
  +                    return fEnumeration.elementAt(index);
  +                }
  +            };
  +        }
  +        return fActualEnumeration;
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to