Please tell me how do I get the elements of an enumeration attribute. For
e.g if I have Attrbute prty (odd|even) "odd".  the parser gives me the value
that is set or that is defalutt(if it is not set). However I need all the
numeration elements because I want to add them to a list box so that a user
can choose an option.


-----Original Message-----
From: Eric Ye [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 06, 2000 12:20 PM
To: [EMAIL PROTECTED]
Subject: cvs commit:
xml-xerces/java/src/org/apache/xerces/validators/schema
TraverseSchema.java


ericye      00/07/06 12:19:40

  Modified:    java/src/org/apache/xerces/validators/schema
                        TraverseSchema.java
  Log:
  duplicate elementDecl is allowed as long as they have the same type
definition.
  --ericye
  
  Revision  Changes    Path
  1.34      +16 -7
xml-xerces/java/src/org/apache/xerces/validators/schema/TraverseSchema.java
  
  Index: TraverseSchema.java
  ===================================================================
  RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/validators/schema/TraverseSc
hema.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- TraverseSchema.java       2000/07/04 01:28:55     1.33
  +++ TraverseSchema.java       2000/07/06 19:19:37     1.34
  @@ -374,7 +374,7 @@
    *         Eric Ye
    * @see                  org.apache.xerces.validators.common.Grammar
    *
  - * @version $Id: TraverseSchema.java,v 1.33 2000/07/04 01:28:55 ericye
Exp $
  + * @version $Id: TraverseSchema.java,v 1.34 2000/07/06 19:19:37 ericye
Exp $
    */
   
   public class TraverseSchema implements 
  @@ -424,6 +424,7 @@
       private String fCurrentSchemaURL = "";
   
       private XMLAttributeDecl fTempAttributeDecl = new XMLAttributeDecl();
  +    private XMLElementDecl fTempElementDecl = new XMLElementDecl();
   
       // REVISIT: maybe need to be moved into SchemaGrammar class
       public class ComplexTypeInfo {
  @@ -2715,12 +2716,20 @@
           }
   
   
  -        //There can never be two elements with the same name in the same
scope.
  -        if (fSchemaGrammar.getElementDeclIndex(localpartIndex,
enclosingScope) > -1) {
  -            noErrorSoFar = false;
  -            // REVISIT: Localize
  -            reportGenericSchemaError("duplicate element decl in the same
scope : " + 
  -                              fStringPool.toString(localpartIndex));
  +        //There can never be two elements with the same name and
different type in the same scope.
  +        int existSuchElementIndex =
fSchemaGrammar.getElementDeclIndex(localpartIndex, enclosingScope);
  +        if ( existSuchElementIndex > -1) {
  +            fSchemaGrammar.getElementDecl(existSuchElementIndex,
fTempElementDecl);
  +            DatatypeValidator edv = fTempElementDecl.datatypeValidator;
  +            ComplexTypeInfo eTypeInfo =
fSchemaGrammar.getElementComplexTypeInfo(existSuchElementIndex);
  +            if ( ((eTypeInfo != null)&&(eTypeInfo!=typeInfo))
  +                 || ((edv != null)&&(edv != dv)) )  {
  +                noErrorSoFar = false;
  +                // REVISIT: Localize
  +                reportGenericSchemaError("duplicate element decl in the
same scope : " + 
  +
fStringPool.toString(localpartIndex));
  +
  +            }
           }
   
           QName eltQName = new
QName(-1,localpartIndex,elementNameIndex,uriIndex);
  
  
  

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

Reply via email to