You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by sa...@apache.org on 2002/05/30 20:00:55 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/xni/psvi AttributePSVI.java ElementPSVI.java ItemPSVI.java

sandygao    02/05/30 11:00:55

  Modified:    java/docs faq-write.xml
               java/samples/dom ASBuilder.java
               java/samples/sax Counter.java
               java/samples/xni PSVIWriter.java
               java/src/org/apache/xerces/impl/xs AttributePSVImpl.java
                        ElementPSVImpl.java XMLSchemaValidator.java
               java/src/org/apache/xerces/parsers AbstractDOMParser.java
                        AbstractSAXParser.java
               java/src/org/apache/xerces/xni/psvi AttributePSVI.java
                        ElementPSVI.java ItemPSVI.java
  Log:
  The updated PSVI interfaces and the implementation:
  - updated some constant/method names;
  - expose heavy weight properties.
  A discussion on the mailing list suggests to change getIsXXX methods to
  isXXX. We may need to continue the discussion. When we get a conclusion
  from there, we might change some of the method names.
  
  Revision  Changes    Path
  1.14      +41 -2     xml-xerces/java/docs/faq-write.xml
  
  Index: faq-write.xml
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/docs/faq-write.xml,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- faq-write.xml	29 Jan 2002 17:13:07 -0000	1.13
  +++ faq-write.xml	30 May 2002 18:00:54 -0000	1.14
  @@ -114,7 +114,7 @@
       }
       public void fatalError(SAXParseException e) throws SAXException {
           System.err.println("[fatal error] "+e.getMessage());
  -	throw e;
  +    throw e;
       }
   };
   
  @@ -138,7 +138,7 @@
       }
       public void fatalError(SAXParseException e) throws SAXException {
           System.err.println("[fatal error] "+e.getMessage());
  -	throw e;
  +    throw e;
       }
   };
   
  @@ -290,6 +290,45 @@
        DTDs in a memory buffer.
       </li>
      </ul>
  +  </a>
  + </faq>
  + <faq title='Pull-parsing documents'>
  +  <q>
  +   How can I parse documents in a pull-parsing fashion?
  +  </q>
  +  <a>
  +   <p>
  +    Since the pull-parsing API is specific to Xerces, you have to use
  +    Xerces-specific way to create parsers, and parse documents.
  +   </p>
  +   <p>
  +    You first need to create a parser configuration that implements the
  +    <code>XMLPullParserConfiguration</code> interface. Then you need to
  +    create a parser from this configuration. To parse documents, method
  +    <code>parse(boolean)</code> should be called.
  +   </p>
  +   <source>import org.apache.xerces.parsers.StandardParserConfiguration;
  +import org.apache.xerces.parsers.SAXParser;
  +import org.apache.xerces.xni.parser.XMLInputSource;
  +
  +  ...
  +
  +boolean continueParse = true;
  +void pullParse(XMLInputSource input) throws Exception {
  +    StandardParserConfiguration config = new StandardParserConfiguration();
  +    SAXParser parser = new SAXParser(config);
  +    config.setInputSource(input);
  +    parser.reset();
  +    while (continueParse)
  +        config.parse(false);
  +}</source>
  +    <p>
  +     In the above example, a SAXParser is used to to pull-parse an
  +     XMLInputSource. DOMParser can be used in a similar way. A flag
  +     <code>continueParse</code> is used to indicate whether to continue
  +     parsing the document. The application can stop the parsing by
  +     setting this flag to false.
  +    </p>
     </a>
    </faq>
    <!--
  
  
  
  1.6       +160 -2    xml-xerces/java/samples/dom/ASBuilder.java
  
  Index: ASBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/samples/dom/ASBuilder.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ASBuilder.java	4 Apr 2002 00:00:06 -0000	1.5
  +++ ASBuilder.java	30 May 2002 18:00:54 -0000	1.6
  @@ -71,6 +71,12 @@
   import org.w3c.dom.DOMImplementation;
   import java.util.Vector;
   
  +import org.apache.xerces.dom.ASModelImpl;
  +import org.apache.xerces.impl.xs.XSModelImpl;
  +import org.apache.xerces.impl.xs.psvi.*;
  +import org.apache.xerces.impl.xs.SchemaGrammar;
  +import java.util.Enumeration;
  +
   /**
    * This sample program illustrates how to use DOM3 DOMASBuilder interface to
    * preparse ASModels and associate ASModels with an instance document to be
  @@ -92,7 +98,7 @@
    * NOTE: this behavior might be changed
    * 
    * @author Sandy Gao, IBM
  - * @version $Id: ASBuilder.java,v 1.5 2002/04/04 00:00:06 elena Exp $
  + * @version $Id: ASBuilder.java,v 1.6 2002/05/30 18:00:54 sandygao Exp $
    */
   public class ASBuilder implements DOMErrorHandler {
   
  @@ -205,8 +211,8 @@
           // PARSING XML SCHEMAS
           //
   
  +        ASModel asmodel = null;
           try {
  -            ASModel asmodel = null;
               for (i = 0; i < asfiles.size(); i++) {
                   asmodel = parser.parseASURI((String)asfiles.elementAt(i));
                   parser.setAbstractSchema(asmodel);
  @@ -228,6 +234,8 @@
               }
           }
   
  +        testXSModel(asmodel);
  +        
       } // main(String[])
   
       //
  @@ -291,4 +299,154 @@
           return error.getSeverity() != DOMError.SEVERITY_FATAL_ERROR;
       }
   
  +    static private XSModel as2xsModel(ASModel asmodel) {
  +        ASModelImpl model = (ASModelImpl)asmodel;
  +        Vector models = model.getInternalASModels();
  +        SchemaGrammar[] grammars = new SchemaGrammar[models.size()];
  +        for (int i = 0; i < models.size(); i++)
  +            grammars[i] = ((ASModelImpl)models.elementAt(i)).getGrammar();
  +        return new XSModelImpl(grammars);
  +    }
  +
  +    static void testXSModel(ASModel asmodel) {
  +
  +        XSModel model = as2xsModel(asmodel);
  +        
  +        System.out.println("Namespaces:");
  +        Enumeration namespaces = model.getNamespaces();
  +        while (namespaces.hasMoreElements())
  +            System.out.println(namespaces.nextElement());
  +            
  +        XSNamedMap components;
  +
  +        System.out.println();
  +        System.out.println("Type Definitions:");
  +        components = model.getComponents(XSConstants.TYPE_DEFINITION);
  +        int typecount = components.getMapLength();
  +        XSNamedMap ccomponents = model.getComponents(XSTypeDefinition.COMPLEX_TYPE);
  +        int complexcount = ccomponents.getMapLength();
  +        XSNamedMap scomponents = model.getComponents(XSTypeDefinition.SIMPLE_TYPE);
  +        int simplecount = scomponents.getMapLength();
  +        System.out.println("total = " + typecount + "; complex = " + complexcount + "; simple = " + simplecount);
  +        
  +        System.out.println();
  +        System.out.println("Complex Type Definitions:");
  +        XSComplexTypeDefinition complexType = (XSComplexTypeDefinition)ccomponents.getItem(0);
  +        System.out.println("namespace: " + complexType.getNamespace());
  +        System.out.println("name: " + complexType.getName());
  +        System.out.println("base: " + complexType.getBaseType().getName());
  +        System.out.println("final: " + complexType.getFinal());
  +        System.out.println("anonymous: " + complexType.getIsAnonymous());
  +        System.out.println("derivation: " + complexType.getDerivationMethod());
  +        System.out.println("abstract: " + complexType.getIsAbstract());
  +        System.out.println("content: " + complexType.getContentType());
  +        XSParticle particle = complexType.getParticle();
  +        if (particle != null)
  +            System.out.println("particle: " + particle.getType());
  +
  +        System.out.println();
  +        System.out.println("Simple Type Definitions:");
  +        XSSimpleTypeDefinition simpleType = (XSSimpleTypeDefinition)scomponents.getItem(0);
  +        System.out.println("namespace: " + simpleType.getNamespace());
  +        System.out.println("name: " + simpleType.getName());
  +        System.out.println("base: " + simpleType.getBaseType().getName());
  +        System.out.println("final: " + simpleType.getFinal());
  +        System.out.println("anonymous: " + simpleType.getIsAnonymous());
  +        System.out.println("defined facets: " + simpleType.getDefinedFacets());
  +        System.out.println("fixed facets: " + simpleType.getFixedFacets());
  +        System.out.println("variety: " + simpleType.getVariety());
  +        
  +        components = model.getComponentsByNamespace(XSTypeDefinition.SIMPLE_TYPE, simpleType.getNamespace());
  +        simpleType = (XSSimpleTypeDefinition)components.getItem(0);
  +        System.out.println("namespace: " + simpleType.getNamespace());
  +        System.out.println("name: " + simpleType.getName());
  +
  +        simpleType = (XSSimpleTypeDefinition)model.getTypeDefinition(simpleType.getName(), simpleType.getNamespace());
  +        System.out.println("namespace: " + simpleType.getNamespace());
  +        System.out.println("name: " + simpleType.getName());
  +        
  +        System.out.println();
  +        System.out.println("Elements:");
  +        components = model.getComponents(XSConstants.ELEMENT_DECLARATION);
  +        XSElementDeclaration element = (XSElementDeclaration)components.getItem(0);
  +        System.out.println("namespace: " + element.getNamespace());
  +        System.out.println("name: " + element.getName());
  +        System.out.println("type: " + element.getTypeDefinition().getName());
  +        System.out.println("scope: " + element.getScope());
  +        System.out.println("constraint: " + element.getConstraintType() + ", " + element.getConstraintValue());
  +        System.out.println("nillable: " + element.getIsNillable());
  +        System.out.println("abstract: " + element.getIsAbstract());
  +        
  +        components = model.getComponentsByNamespace(XSConstants.ELEMENT_DECLARATION, element.getNamespace());
  +        element = (XSElementDeclaration)components.getItem(0);
  +        System.out.println("namespace: " + element.getNamespace());
  +        System.out.println("name: " + element.getName());
  +
  +        element = model.getElementDecl(element.getName(), element.getNamespace());
  +        System.out.println("namespace: " + element.getNamespace());
  +        System.out.println("name: " + element.getName());
  +        
  +        System.out.println();
  +        System.out.println("Attribute Group:");
  +        components = model.getComponents(XSConstants.ATTRIBUTE_GROUP);
  +        XSAttributeGroupDefinition attrgrp = (XSAttributeGroupDefinition)components.getItem(0);
  +        System.out.println("namespace: " + attrgrp.getNamespace());
  +        System.out.println("name: " + attrgrp.getName());
  +        if (attrgrp.getAttributeWildcard() != null)
  +        System.out.println("wildcard: " + attrgrp.getAttributeWildcard().getConstraintType() + ", " + attrgrp.getAttributeWildcard().getProcessContents());
  +        System.out.println("uses: " + attrgrp.getAttributeUses().getListLength());
  +        System.out.println("uses: " + ((XSAttributeUse)attrgrp.getAttributeUses().getItem(0)).getAttrDeclaration().getName());
  +        
  +        components = model.getComponentsByNamespace(XSConstants.ATTRIBUTE_GROUP, attrgrp.getNamespace());
  +        attrgrp = (XSAttributeGroupDefinition)components.getItem(0);
  +        System.out.println("namespace: " + attrgrp.getNamespace());
  +        System.out.println("name: " + attrgrp.getName());
  +
  +        attrgrp = model.getAttributeGroup(attrgrp.getName(), attrgrp.getNamespace());
  +        System.out.println("namespace: " + attrgrp.getNamespace());
  +        System.out.println("name: " + attrgrp.getName());
  +        
  +        System.out.println();
  +        System.out.println("Group:");
  +        components = model.getComponents(XSConstants.MODEL_GROUP_DEFINITION);
  +        XSModelGroupDefinition group = (XSModelGroupDefinition)components.getItem(0);
  +        System.out.println("namespace: " + group.getNamespace());
  +        System.out.println("name: " + group.getName());
  +        XSModelGroup modelgroup = group.getModelGroup();
  +        System.out.println("model group: " + modelgroup.getCompositor());
  +        System.out.println("model group: " + modelgroup.getParticles().getListLength());
  +        particle = (XSParticle)modelgroup.getParticles().getItem(0);
  +        System.out.println("particle: " + particle.getTerm().getType());
  +        System.out.println("particle: " + particle.getMinOccurs());
  +        System.out.println("particle: " + particle.getMaxOccurs());
  +        
  +        components = model.getComponentsByNamespace(XSConstants.MODEL_GROUP_DEFINITION, group.getNamespace());
  +        group = (XSModelGroupDefinition)components.getItem(0);
  +        System.out.println("namespace: " + group.getNamespace());
  +        System.out.println("name: " + group.getName());
  +
  +        group = model.getModelGroupDefinition(group.getName(), group.getNamespace());
  +        System.out.println("namespace: " + group.getNamespace());
  +        System.out.println("name: " + group.getName());
  +        
  +        System.out.println();
  +        System.out.println("notation:");
  +        components = model.getComponents(XSConstants.NOTATION_DECLARATION);
  +        XSNotationDeclaration notation = (XSNotationDeclaration)components.getItem(0);
  +        if (notation == null) return;
  +        System.out.println("namespace: " + notation.getNamespace());
  +        System.out.println("name: " + notation.getName());
  +        System.out.println("system id: " + notation.getSystemId());
  +        System.out.println("public id: " + notation.getPublicId());
  +        
  +        components = model.getComponentsByNamespace(XSConstants.NOTATION_DECLARATION, notation.getNamespace());
  +        notation = (XSNotationDeclaration)components.getItem(0);
  +        System.out.println("namespace: " + notation.getNamespace());
  +        System.out.println("name: " + notation.getName());
  +
  +        notation = model.getNotationDecl(notation.getName(), notation.getNamespace());
  +        System.out.println("namespace: " + notation.getNamespace());
  +        System.out.println("name: " + notation.getName());
  +        
  +    }
   } // class DOMCount
  
  
  
  1.8       +602 -1    xml-xerces/java/samples/sax/Counter.java
  
  Index: Counter.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/samples/sax/Counter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Counter.java	29 Jan 2002 01:15:06 -0000	1.7
  +++ Counter.java	30 May 2002 18:00:54 -0000	1.8
  @@ -90,11 +90,24 @@
    *
    * @author Andy Clark, IBM
    *
  - * @version $Id: Counter.java,v 1.7 2002/01/29 01:15:06 lehors Exp $
  + * @version $Id: Counter.java,v 1.8 2002/05/30 18:00:54 sandygao Exp $
    */
   public class Counter
       extends DefaultHandler {
   
  +    static {
  +        try {
  +            //String encoding = System.getProperty("file.encoding");
  +            //String userdir = org.apache.xerces.impl.XMLEntityManager.getUserDir();
  +            //int i = 0;
  +        } catch (Exception e) {
  +            e.printStackTrace();
  +        }
  +        finally {
  +            //System.exit(1);
  +        }
  +    }
  +
       //
       // Constants
       //
  @@ -355,6 +368,8 @@
       /** Main program entry point. */
       public static void main(String argv[]) {
   
  +        //testSymbolTable();
  +
           // is there anything to do?
           if (argv.length == 0) {
               printUsage();
  @@ -637,4 +652,590 @@
   
       } // printUsage()
   
  +    static void testSymbolTable() {
  +        SymbolTable st = new SymbolTable();
  +        SymbolTable1 st1 = new SymbolTable1();
  +        SymbolTable2 st2 = new SymbolTable2();
  +
  +        int[] strNum = {10, 50, 100, 200, 500, 1000};
  +        int[] ratio = {0, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000};
  +        long[][] time = new long[strNum.length][ratio.length];
  +        long[][] time1 = new long[strNum.length][ratio.length];
  +        long[][] time2 = new long[strNum.length][ratio.length];
  +
  +        String temp;
  +
  +        for (int i = 0; i < strNum.length; i++) {
  +            for (int j = 0; j < ratio.length; j++) {
  +                long start = System.currentTimeMillis();
  +                for (int str = 0; str < strNum[i]; str++) {
  +                    temp = "str"+i+" "+j+" "+str;
  +                    for (int ra = -1; ra < ratio[j]; ra++) {
  +                        temp = st.addSymbol(temp);
  +                    }
  +                }
  +                long end = System.currentTimeMillis();
  +                time[i][j] = end-start;
  +            }
  +        }
  +
  +        for (int i = 0; i < strNum.length; i++) {
  +            for (int j = 0; j < ratio.length; j++) {
  +                long start = System.currentTimeMillis();
  +                for (int str = 0; str < strNum[i]; str++) {
  +                    temp = "str"+i+" "+j+" "+str;
  +                    for (int ra = -1; ra < ratio[j]; ra++) {
  +                        temp = st1.addSymbol(temp);
  +                    }
  +                }
  +                long end = System.currentTimeMillis();
  +                time1[i][j] = end-start;
  +            }
  +        }
  +
  +        for (int i = 0; i < strNum.length; i++) {
  +            for (int j = 0; j < ratio.length; j++) {
  +                long start = System.currentTimeMillis();
  +                for (int str = 0; str < strNum[i]; str++) {
  +                    temp = "str"+i+" "+j+" "+str;
  +                    for (int ra = -1; ra < ratio[j]; ra++) {
  +                        temp = st2.addSymbol(temp);
  +                    }
  +                }
  +                long end = System.currentTimeMillis();
  +                time2[i][j] = end-start;
  +            }
  +        }
  +
  +        System.out.println("\nSymbolTable without string interning");
  +        for (int j = 0; j < ratio.length; j++) {
  +            System.out.print("\t"+ratio[j]);
  +        }
  +        System.out.println();
  +        for (int i = 0; i < strNum.length; i++) {
  +            System.out.print(strNum[i]);
  +            for (int j = 0; j < ratio.length; j++) {
  +                System.out.print("\t"+time[i][j]);
  +            }
  +            System.out.println();
  +        }
  +
  +        System.out.println("\nSymbolTable with string interning");
  +        for (int j = 0; j < ratio.length; j++) {
  +            System.out.print("\t"+ratio[j]);
  +        }
  +        System.out.println();
  +        for (int i = 0; i < strNum.length; i++) {
  +            System.out.print(strNum[i]);
  +            for (int j = 0; j < ratio.length; j++) {
  +                System.out.print("\t"+time1[i][j]);
  +            }
  +            System.out.println();
  +        }
  +
  +        System.out.println("\nString interning only");
  +        for (int j = 0; j < ratio.length; j++) {
  +            System.out.print("\t"+ratio[j]);
  +        }
  +        System.out.println();
  +        for (int i = 0; i < strNum.length; i++) {
  +            System.out.print(strNum[i]);
  +            for (int j = 0; j < ratio.length; j++) {
  +                System.out.print("\t"+time2[i][j]);
  +            }
  +            System.out.println();
  +        }
  +
  +        System.exit(0);
  +    }
  +
  +    static class SymbolTable {
  +
  +        //
  +        // Constants
  +        //
  +
  +        /** Default table size. */
  +        protected static final int TABLE_SIZE = 101;
  +
  +        //
  +        // Data
  +        //
  +
  +        /** Buckets. */
  +        protected Entry[] fBuckets = new Entry[TABLE_SIZE];
  +
  +        //
  +        // Constructors
  +        //
  +
  +        /** Constructs a symbol table. */
  +        public SymbolTable() {
  +        }
  +
  +        //
  +        // Public methods
  +        //
  +
  +        /**
  +         * Adds the specified symbol to the symbol table and returns a
  +         * reference to the unique symbol. If the symbol already exists,
  +         * the previous symbol reference is returned instead, in order
  +         * guarantee that symbol references remain unique.
  +         *
  +         * @param symbol The new symbol.
  +         */
  +        public String addSymbol(String symbol) {
  +
  +            // search for identical symbol
  +            int bucket = hash(symbol) % TABLE_SIZE;
  +            int length = symbol.length();
  +            OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) {
  +                if (length == entry.characters.length) {
  +                    for (int i = 0; i < length; i++) {
  +                        if (symbol.charAt(i) != entry.characters[i]) {
  +                            continue OUTER;
  +                        }
  +                    }
  +                    return entry.symbol;
  +                }
  +            }
  +
  +            // create new entry
  +            Entry entry = new Entry(symbol, fBuckets[bucket]);
  +            fBuckets[bucket] = entry;
  +            return entry.symbol;
  +
  +        } // addSymbol(String):String
  +
  +        /**
  +         * Adds the specified symbol to the symbol table and returns a
  +         * reference to the unique symbol. If the symbol already exists,
  +         * the previous symbol reference is returned instead, in order
  +         * guarantee that symbol references remain unique.
  +         *
  +         * @param buffer The buffer containing the new symbol.
  +         * @param offset The offset into the buffer of the new symbol.
  +         * @param length The length of the new symbol in the buffer.
  +         */
  +        public String addSymbol(char[] buffer, int offset, int length) {
  +
  +            // search for identical symbol
  +            int bucket = hash(buffer, offset, length) % TABLE_SIZE;
  +            OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) {
  +                if (length == entry.characters.length) {
  +                    for (int i = 0; i < length; i++) {
  +                        if (buffer[offset + i] != entry.characters[i]) {
  +                            continue OUTER;
  +                        }
  +                    }
  +                    return entry.symbol;
  +                }
  +            }
  +
  +            // add new entry
  +            Entry entry = new Entry(buffer, offset, length, fBuckets[bucket]);
  +            fBuckets[bucket] = entry;
  +            return entry.symbol;
  +
  +        } // addSymbol(char[],int,int):String
  +
  +        /**
  +         * Returns a hashcode value for the specified symbol. The value
  +         * returned by this method must be identical to the value returned
  +         * by the <code>hash(char[],int,int)</code> method when called
  +         * with the character array that comprises the symbol string.
  +         *
  +         * @param symbol The symbol to hash.
  +         */
  +        public int hash(String symbol) {
  +
  +            int code = 0;
  +            int length = symbol.length();
  +            for (int i = 0; i < length; i++) {
  +                code = code * 37 + symbol.charAt(i);
  +            }
  +            return code & 0x7FFFFFF;
  +
  +        } // hash(String):int
  +
  +        /**
  +         * Returns a hashcode value for the specified symbol information.
  +         * The value returned by this method must be identical to the value
  +         * returned by the <code>hash(String)</code> method when called
  +         * with the string object created from the symbol information.
  +         *
  +         * @param buffer The character buffer containing the symbol.
  +         * @param offset The offset into the character buffer of the start
  +         *               of the symbol.
  +         * @param length The length of the symbol.
  +         */
  +        public int hash(char[] buffer, int offset, int length) {
  +
  +            int code = 0;
  +            for (int i = 0; i < length; i++) {
  +                code = code * 37 + buffer[offset + i];
  +            }
  +            return code & 0x7FFFFFF;
  +
  +        } // hash(char[],int,int):int
  +
  +        /**
  +         * Returns true if the symbol table already contains the specified
  +         * symbol.
  +         *
  +         * @param symbol The symbol to look for.
  +         */
  +        public boolean containsSymbol(String symbol) {
  +
  +            // search for identical symbol
  +            int bucket = hash(symbol) % TABLE_SIZE;
  +            int length = symbol.length();
  +            OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) {
  +                if (length == entry.characters.length) {
  +                    for (int i = 0; i < length; i++) {
  +                        if (symbol.charAt(i) != entry.characters[i]) {
  +                            continue OUTER;
  +                        }
  +                    }
  +                    return true;
  +                }
  +            }
  +
  +            return false;
  +
  +        } // containsSymbol(String):boolean
  +
  +        /**
  +         * Returns true if the symbol table already contains the specified
  +         * symbol.
  +         *
  +         * @param buffer The buffer containing the symbol to look for.
  +         * @param offset The offset into the buffer.
  +         * @param length The length of the symbol in the buffer.
  +         */
  +        public boolean containsSymbol(char[] buffer, int offset, int length) {
  +
  +            // search for identical symbol
  +            int bucket = hash(buffer, offset, length) % TABLE_SIZE;
  +            OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) {
  +                if (length == entry.characters.length) {
  +                    for (int i = 0; i < length; i++) {
  +                        if (buffer[offset + i] != entry.characters[i]) {
  +                            continue OUTER;
  +                        }
  +                    }
  +                    return true;
  +                }
  +            }
  +
  +            return false;
  +
  +        } // containsSymbol(char[],int,int):boolean
  +
  +        //
  +        // Classes
  +        //
  +
  +        /**
  +         * This class is a symbol table entry. Each entry acts as a node
  +         * in a linked list.
  +         */
  +        protected static final class Entry {
  +
  +            //
  +            // Data
  +            //
  +
  +            /** Symbol. */
  +            public String symbol;
  +
  +            /**
  +             * Symbol characters. This information is duplicated here for
  +             * comparison performance.
  +             */
  +            public char[] characters;
  +
  +            /** The next entry. */
  +            public Entry next;
  +
  +            //
  +            // Constructors
  +            //
  +
  +            /**
  +             * Constructs a new entry from the specified symbol and next entry
  +             * reference.
  +             */
  +            public Entry(String symbol, Entry next) {
  +                this.symbol = symbol;
  +                characters = new char[symbol.length()];
  +                symbol.getChars(0, characters.length, characters, 0);
  +                this.next = next;
  +            }
  +
  +            /**
  +             * Constructs a new entry from the specified symbol information and
  +             * next entry reference.
  +             */
  +            public Entry(char[] ch, int offset, int length, Entry next) {
  +                characters = new char[length];
  +                System.arraycopy(ch, offset, characters, 0, length);
  +                symbol = new String(characters);
  +                this.next = next;
  +            }
  +
  +        } // class Entry
  +
  +    } // class SymbolTable
  +
  +    static class SymbolTable1 {
  +
  +        //
  +        // Constants
  +        //
  +
  +        /** Default table size. */
  +        protected static final int TABLE_SIZE = 101;
  +
  +        //
  +        // Data
  +        //
  +
  +        /** Buckets. */
  +        protected Entry[] fBuckets = new Entry[TABLE_SIZE];
  +
  +        //
  +        // Constructors
  +        //
  +
  +        /** Constructs a symbol table. */
  +        public SymbolTable1() {
  +        }
  +
  +        //
  +        // Public methods
  +        //
  +
  +        /**
  +         * Adds the specified symbol to the symbol table and returns a
  +         * reference to the unique symbol. If the symbol already exists,
  +         * the previous symbol reference is returned instead, in order
  +         * guarantee that symbol references remain unique.
  +         *
  +         * @param symbol The new symbol.
  +         */
  +        public String addSymbol(String symbol) {
  +
  +            // search for identical symbol
  +            int bucket = hash(symbol) % TABLE_SIZE;
  +            int length = symbol.length();
  +            OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) {
  +                if (length == entry.characters.length) {
  +                    for (int i = 0; i < length; i++) {
  +                        if (symbol.charAt(i) != entry.characters[i]) {
  +                            continue OUTER;
  +                        }
  +                    }
  +                    return entry.symbol;
  +                }
  +            }
  +
  +            // create new entry
  +            Entry entry = new Entry(symbol, fBuckets[bucket]);
  +            fBuckets[bucket] = entry;
  +            return entry.symbol;
  +
  +        } // addSymbol(String):String
  +
  +        /**
  +         * Adds the specified symbol to the symbol table and returns a
  +         * reference to the unique symbol. If the symbol already exists,
  +         * the previous symbol reference is returned instead, in order
  +         * guarantee that symbol references remain unique.
  +         *
  +         * @param buffer The buffer containing the new symbol.
  +         * @param offset The offset into the buffer of the new symbol.
  +         * @param length The length of the new symbol in the buffer.
  +         */
  +        public String addSymbol(char[] buffer, int offset, int length) {
  +
  +            // search for identical symbol
  +            int bucket = hash(buffer, offset, length) % TABLE_SIZE;
  +            OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) {
  +                if (length == entry.characters.length) {
  +                    for (int i = 0; i < length; i++) {
  +                        if (buffer[offset + i] != entry.characters[i]) {
  +                            continue OUTER;
  +                        }
  +                    }
  +                    return entry.symbol;
  +                }
  +            }
  +
  +            // add new entry
  +            Entry entry = new Entry(buffer, offset, length, fBuckets[bucket]);
  +            fBuckets[bucket] = entry;
  +            return entry.symbol;
  +
  +        } // addSymbol(char[],int,int):String
  +
  +        /**
  +         * Returns a hashcode value for the specified symbol. The value
  +         * returned by this method must be identical to the value returned
  +         * by the <code>hash(char[],int,int)</code> method when called
  +         * with the character array that comprises the symbol string.
  +         *
  +         * @param symbol The symbol to hash.
  +         */
  +        public int hash(String symbol) {
  +
  +            int code = 0;
  +            int length = symbol.length();
  +            for (int i = 0; i < length; i++) {
  +                code = code * 37 + symbol.charAt(i);
  +            }
  +            return code & 0x7FFFFFF;
  +
  +        } // hash(String):int
  +
  +        /**
  +         * Returns a hashcode value for the specified symbol information.
  +         * The value returned by this method must be identical to the value
  +         * returned by the <code>hash(String)</code> method when called
  +         * with the string object created from the symbol information.
  +         *
  +         * @param buffer The character buffer containing the symbol.
  +         * @param offset The offset into the character buffer of the start
  +         *               of the symbol.
  +         * @param length The length of the symbol.
  +         */
  +        public int hash(char[] buffer, int offset, int length) {
  +
  +            int code = 0;
  +            for (int i = 0; i < length; i++) {
  +                code = code * 37 + buffer[offset + i];
  +            }
  +            return code & 0x7FFFFFF;
  +
  +        } // hash(char[],int,int):int
  +
  +        /**
  +         * Returns true if the symbol table already contains the specified
  +         * symbol.
  +         *
  +         * @param symbol The symbol to look for.
  +         */
  +        public boolean containsSymbol(String symbol) {
  +
  +            // search for identical symbol
  +            int bucket = hash(symbol) % TABLE_SIZE;
  +            int length = symbol.length();
  +            OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) {
  +                if (length == entry.characters.length) {
  +                    for (int i = 0; i < length; i++) {
  +                        if (symbol.charAt(i) != entry.characters[i]) {
  +                            continue OUTER;
  +                        }
  +                    }
  +                    return true;
  +                }
  +            }
  +
  +            return false;
  +
  +        } // containsSymbol(String):boolean
  +
  +        /**
  +         * Returns true if the symbol table already contains the specified
  +         * symbol.
  +         *
  +         * @param buffer The buffer containing the symbol to look for.
  +         * @param offset The offset into the buffer.
  +         * @param length The length of the symbol in the buffer.
  +         */
  +        public boolean containsSymbol(char[] buffer, int offset, int length) {
  +
  +            // search for identical symbol
  +            int bucket = hash(buffer, offset, length) % TABLE_SIZE;
  +            OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) {
  +                if (length == entry.characters.length) {
  +                    for (int i = 0; i < length; i++) {
  +                        if (buffer[offset + i] != entry.characters[i]) {
  +                            continue OUTER;
  +                        }
  +                    }
  +                    return true;
  +                }
  +            }
  +
  +            return false;
  +
  +        } // containsSymbol(char[],int,int):boolean
  +
  +        //
  +        // Classes
  +        //
  +
  +        /**
  +         * This class is a symbol table entry. Each entry acts as a node
  +         * in a linked list.
  +         */
  +        protected static final class Entry {
  +
  +            //
  +            // Data
  +            //
  +
  +            /** Symbol. */
  +            public String symbol;
  +
  +            /**
  +             * Symbol characters. This information is duplicated here for
  +             * comparison performance.
  +             */
  +            public char[] characters;
  +
  +            /** The next entry. */
  +            public Entry next;
  +
  +            //
  +            // Constructors
  +            //
  +
  +            /**
  +             * Constructs a new entry from the specified symbol and next entry
  +             * reference.
  +             */
  +            public Entry(String symbol, Entry next) {
  +                this.symbol = symbol.intern();
  +                characters = new char[symbol.length()];
  +                symbol.getChars(0, characters.length, characters, 0);
  +                this.next = next;
  +            }
  +
  +            /**
  +             * Constructs a new entry from the specified symbol information and
  +             * next entry reference.
  +             */
  +            public Entry(char[] ch, int offset, int length, Entry next) {
  +                characters = new char[length];
  +                System.arraycopy(ch, offset, characters, 0, length);
  +                symbol = new String(characters).intern();
  +                this.next = next;
  +            }
  +
  +        } // class Entry
  +
  +    } // class SymbolTable1
  +
  +    static class SymbolTable2 {
  +        public String addSymbol(String symbol) {
  +            return symbol.intern();
  +        } // addSymbol(String):String
  +
  +        public String addSymbol(char[] buffer, int offset, int length) {
  +            return new String(buffer, offset, length).intern();;
  +        } // addSymbol(char[],int,int):String
  +    } // class SymbolTable2
   } // class Counter
  
  
  
  1.7       +57 -45    xml-xerces/java/samples/xni/PSVIWriter.java
  
  Index: PSVIWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/samples/xni/PSVIWriter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PSVIWriter.java	28 Jan 2002 19:51:51 -0000	1.6
  +++ PSVIWriter.java	30 May 2002 18:00:54 -0000	1.7
  @@ -66,6 +66,7 @@
   import org.apache.xerces.util.XMLAttributesImpl;
   
   //for testing
  +import org.apache.xerces.impl.xs.psvi.*;
   import org.apache.xerces.impl.xs.XSTypeDecl;
   import org.apache.xerces.impl.xs.ElementPSVImpl;
   import org.apache.xerces.impl.xs.AttributePSVImpl;
  @@ -106,7 +107,7 @@
    * XML infoset and Post Schema Validation Infoset.
    * 
    * @author Arun  Yadav,Sun Miscrosystem.
  - * @version $Id: PSVIWriter.java,v 1.6 2002/01/28 19:51:51 elena Exp $
  + * @version $Id: PSVIWriter.java,v 1.7 2002/05/30 18:00:54 sandygao Exp $
    */
   public class PSVIWriter
   implements XMLComponent, XMLDocumentFilter {
  @@ -127,7 +128,7 @@
       protected static final String INCLUDE_IGNORABLE_WHITESPACE =
       "http://apache.org/xml/features/dom/include-ignorable-whitespace";
   
  -    protected static final String PSVI_OUTPUT ="psvi_output.xml";
  +    protected static final String PSVI_OUTPUT ="e:\\psvi_output.xml";
   
       /** Include ignorable whitespace. */
       protected boolean fIncludeIgnorableWhitespace;
  @@ -601,7 +602,7 @@
           
           checkForChildren();
           if (elemPSVI != null) {
  -            if (elemPSVI.isSpecified()){  // value was specified in the instance!
  +            if (!elemPSVI.getIsSchemaSpecified()){  // value was specified in the instance!
                   printIndentTag("<character>");
                   printElement("characterCode", text.toString());
                   printElement("elementContentWhitespace", "false");
  @@ -781,23 +782,30 @@
               // REVISIT: Should we store the values till end element call?
               printElement("psv:validationContext",elemPSVI.getValidationContext());
   
  -
  -            short definationType = elemPSVI.getTypeDefinitionType();
  +            XSTypeDefinition type = elemPSVI.getTypeDefinition();
  +            short definationType = type.getTypeCategory();
               if (definationType == XSTypeDecl.SIMPLE_TYPE) {
                   printElement("psv:typeDefinitionType","simple");
               }
               else if (definationType == XSTypeDecl.COMPLEX_TYPE) {
                   printElement("psv:typeDefinitionType","complex");
               }
  -            printElement("psv:typeDefinitionNamespace ",elemPSVI.getTypeNamespace());
  -            printElement("psv:typeDefinitionAnonymous",String.valueOf(elemPSVI.isTypeAnonymous()));
  -
  -            printElement("psv:typeDefinitionName",(elemPSVI.isTypeAnonymous())?null:elemPSVI.getTypeName());
  -            printElement("psv:memberTypeDefinitionAnonymous",String.valueOf(elemPSVI.isMemberTypeAnonymous()));
  -            printElement("psv:memberTypeDefinitionName",(elemPSVI.isMemberTypeAnonymous())?null:elemPSVI.getMemberTypeName());
  -            printElement("psv:memberTypeDefinitionNamespace",elemPSVI.getMemberTypeNamespace());
  -            printElement("psv:notationSystem",elemPSVI.getNotationSystemId());
  -            printElement("psv:notationPublic",elemPSVI.getNotationPublicId());
  +            printElement("psv:typeDefinitionNamespace ",type.getNamespace());
  +            printElement("psv:typeDefinitionAnonymous",String.valueOf(type.getIsAnonymous()));
  +            printElement("psv:typeDefinitionName",type.getName());
  +
  +            XSSimpleTypeDefinition memtype = elemPSVI.getMemberTypeDefinition();
  +            if (memtype != null) {
  +                printElement("psv:memberTypeDefinitionAnonymous",String.valueOf(memtype.getIsAnonymous()));
  +                printElement("psv:memberTypeDefinitionName",memtype.getName());
  +                printElement("psv:memberTypeDefinitionNamespace",memtype.getNamespace());
  +            }
  +            
  +            XSNotationDeclaration notation = elemPSVI.getNotation();
  +            if (notation != null) {
  +                printElement("psv:notationSystem",notation.getSystemId());
  +                printElement("psv:notationPublic",notation.getPublicId());
  +            }
           }
       }
   
  @@ -814,35 +822,35 @@
   
   
               short validation = elemPSVI.getValidationAttempted();
  -            if (validation == ItemPSVI.NO_VALIDATION) {
  +            if (validation == ItemPSVI.VALIDATION_NONE) {
                   printElement("psv:validationAttempted","none");
               }
  -            else if (validation == ItemPSVI.PARTIAL_VALIDATION) {
  +            else if (validation == ItemPSVI.VALIDATION_PARTIAL) {
                   printElement("psv:validationAttempted","partial");
               }
  -            else if (validation == ItemPSVI.FULL_VALIDATION) {
  +            else if (validation == ItemPSVI.VALIDATION_FULL) {
                   printElement("psv:validationAttempted","full");
               }
   
   
               short validity = elemPSVI.getValidity();
  -            if (validity == ItemPSVI.UNKNOWN_VALIDITY) {
  +            if (validity == ItemPSVI.VALIDITY_UNKNOWN) {
                   printElement("psv:validity","unknown");
               }
  -            else if (validity == ItemPSVI.VALID_VALIDITY) {
  +            else if (validity == ItemPSVI.VALIDITY_VALID) {
                   printElement("psv:validity","valid");
               }
  -            else if (validity == ItemPSVI.INVALID_VALIDITY) {
  +            else if (validity == ItemPSVI.VALIDITY_INVALID) {
                   printElement("psv:validity","invalid");
               }
               //revisit
  -            String [] errorCode = elemPSVI.getErrorCodes();
  +            Enumeration errorCode = elemPSVI.getErrorCodes();
               if (errorCode != null) {
  -                int  errorCount = errorCode.length;
  +                fErrorBuffer.append(errorCode.nextElement());
                   
  -                for (int i=0;i< errorCount; i++) {
  -                    fErrorBuffer.append(errorCode[i]);
  +                while (errorCode.hasMoreElements()) {
                       fErrorBuffer.append(" ");
  +                    fErrorBuffer.append(errorCode.nextElement());
                   }
                   printElement("psv:schemaErrorCode",fErrorBuffer.toString());
                   fErrorBuffer.setLength(0);
  @@ -850,9 +858,9 @@
               else {
                   printElement("psv:schemaErrorCode","");
               }
  -            printElement("psv:nil", String.valueOf(elemPSVI.isNil()));
  +            //printElement("psv:nil", String.valueOf(elemPSVI.getIsNil()));
               printElement("psv:schemaNormalizedValue",elemPSVI.getSchemaNormalizedValue());
  -            String specified = elemPSVI.isSpecified()?"infoset":"schema";
  +            String specified = elemPSVI.getIsSchemaSpecified()?"schema":"infoset";
               printElement("psv:schemaSpecified",specified);
   
           }
  @@ -863,36 +871,36 @@
           if (attrPSVI !=null) {
   
               short validation = attrPSVI.getValidationAttempted();
  -            if (validation == ItemPSVI.NO_VALIDATION) {
  +            if (validation == ItemPSVI.VALIDATION_NONE) {
                   printElement("psv:validationAttempted","none");
               }
  -            else if (validation == ItemPSVI.FULL_VALIDATION) {
  +            else if (validation == ItemPSVI.VALIDATION_FULL) {
                   printElement("psv:validationAttempted","full");
               }
   
               printElement("psv:validationContext",attrPSVI.getValidationContext());
   
               short validity = attrPSVI.getValidity();
  -            if (validity == ItemPSVI.UNKNOWN_VALIDITY) {
  +            if (validity == ItemPSVI.VALIDITY_UNKNOWN) {
                   printElement("psv:validity","unknown");
               }
  -            else if (validity == ItemPSVI.VALID_VALIDITY) {
  +            else if (validity == ItemPSVI.VALIDITY_VALID) {
                   printElement("psv:validity","valid");
               }
  -            else if (validity == ItemPSVI.INVALID_VALIDITY) {
  +            else if (validity == ItemPSVI.VALIDITY_INVALID) {
                   printElement("psv:validity","invalid");
               }
   
               //REVISIT
  -            String [] errorCode = attrPSVI.getErrorCodes();
  -            int  errorCount = errorCode.length;
  -            if (errorCount == 0) {
  +            Enumeration errorCode = attrPSVI.getErrorCodes();
  +            if (errorCode == null) {
                   printElement("psv:schemaErrorCode","");
               }
               else {
  -                for (int i=errorCount-1;i< errorCount; ++i) {
  -                    fErrorBuffer.append(errorCode[i]);
  +                fErrorBuffer.append(errorCode.nextElement());
  +                while(errorCode.hasMoreElements()) {
                       fErrorBuffer.append(" ");
  +                    fErrorBuffer.append(errorCode.nextElement());
                   }
                   printElement("psv:schemaErrorCode",fErrorBuffer.toString());
                   fErrorBuffer.setLength(0);
  @@ -900,20 +908,24 @@
               }
   
               printElement("psv:schemaNormalizedValue",attrPSVI.getSchemaNormalizedValue());
  -            printElement("psv:schemaSpecified", (attrPSVI.isSpecified())?"infoset":"schema");
  +            printElement("psv:schemaSpecified", (attrPSVI.getIsSchemaSpecified())?"schema":"infoset");
   
  -            short definationType = attrPSVI.getTypeDefinitionType();
  +            XSTypeDefinition type = attrPSVI.getTypeDefinition();
  +            XSSimpleTypeDefinition memtype = attrPSVI.getMemberTypeDefinition();
  +            short definationType = type.getTypeCategory();
               if (definationType == XSTypeDecl.SIMPLE_TYPE) {
                   printElement("psv:typeDefinitionType","simple");
               }
   
  -            printElement("psv:typeDefinitionNamespace",attrPSVI.getTypeNamespace());
  -            printElement("psv:typeDefinitionAnonymous",String.valueOf(attrPSVI.isTypeAnonymous()));
  -            printElement("psv:typeDefinitionName",(attrPSVI.isTypeAnonymous())?null:attrPSVI.getTypeName());
  -            printElement("psv:memberTypeDefinitionAnonymous",String.valueOf(attrPSVI.isMemberTypeAnonymous()));
  -            printElement("psv:memberTypeDefinitionName",(attrPSVI.isMemberTypeAnonymous())?null:attrPSVI.getMemberTypeName());
  -            printElement("psv:memberTypeDefinitionNamespace",attrPSVI.getMemberTypeNamespace());
  -
  +            printElement("psv:typeDefinitionNamespace",type.getNamespace());
  +            printElement("psv:typeDefinitionAnonymous",String.valueOf(type.getIsAnonymous()));
  +            printElement("psv:typeDefinitionName",type.getName());
  +            
  +            if (memtype != null) {
  +                printElement("psv:memberTypeDefinitionAnonymous",String.valueOf(memtype.getIsAnonymous()));
  +                printElement("psv:memberTypeDefinitionName",memtype.getName());
  +                printElement("psv:memberTypeDefinitionNamespace",memtype.getNamespace());
  +            }
           }
       }
       /**
  
  
  
  1.9       +32 -95    xml-xerces/java/src/org/apache/xerces/impl/xs/AttributePSVImpl.java
  
  Index: AttributePSVImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/AttributePSVImpl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AttributePSVImpl.java	16 May 2002 18:25:54 -0000	1.8
  +++ AttributePSVImpl.java	30 May 2002 18:00:54 -0000	1.9
  @@ -61,8 +61,10 @@
   import org.apache.xerces.impl.xs.XSAttributeDecl;
   import org.apache.xerces.impl.xs.XSNotationDecl;
   import org.apache.xerces.xni.psvi.AttributePSVI;
  +import org.apache.xerces.impl.xs.psvi.*;
   
   import java.util.Vector;
  +import java.util.Enumeration;
   
   /**
    * Attribute PSV infoset augmentations implementation.
  @@ -89,10 +91,10 @@
       protected XSSimpleType fMemberType = null;
   
       /** validation attempted: none, partial, full */
  -    protected short fValidationAttempted = AttributePSVI.NO_VALIDATION;
  +    protected short fValidationAttempted = AttributePSVI.VALIDATION_NONE;
   
       /** validity: valid, invalid, unknown */
  -    protected short fValidity = AttributePSVI.UNKNOWN_VALIDITY;
  +    protected short fValidity = AttributePSVI.VALIDITY_UNKNOWN;
   
       /** error codes */
       protected Vector fErrorCodes = new Vector(10);
  @@ -105,37 +107,6 @@
       //
   
       /**
  -     * [member type definition anonymous]
  -     * @ see <a href="http://www.w3.org/TR/xmlschema-1/#e-member_type_definition_anonymous>XML Schema Part 1: Structures [member type definition anonymous]</a>
  -     * @return true if the {name} of the actual member type definition is absent,
  -     *         otherwise false.
  -     */
  -    public boolean  isMemberTypeAnonymous() {
  -        return (fMemberType !=null)? fMemberType.getIsAnonymous():false;
  -    }
  -
  -
  -    /**
  -     * [member type definition name]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-member_type_definition_name>XML Schema Part 1: Structures [member type definition name]</a>
  -     * @return The {name} of the actual member type definition, if it is not absent.
  -     *         If it is absent, schema processors may, but need not, provide a
  -     *         value unique to the definition.
  -     */
  -    public String   getMemberTypeName() {
  -        return (fMemberType !=null)? fMemberType.getName():null;
  -    }
  -
  -    /**
  -     * [member type definition namespace]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-member_type_definition_namespace>XML Schema Part 1: Structures [member type definition namespace]</a>
  -     * @return The {target namespace} of the actual member type definition.
  -     */
  -    public String   getMemberTypeNamespace() {
  -        return (fMemberType !=null)? fMemberType.getNamespace():null;
  -    }
  -
  -    /**
        * [schema default]
        *
        * @return The canonical lexical representation of the declaration's {value constraint} value.
  @@ -165,52 +136,12 @@
        * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_specified">XML Schema Part 1: Structures [schema specified]</a>
        * @return false value was specified in schema, true value comes from the infoset
        */
  -    public boolean isSpecified() {
  +    public boolean getIsSchemaSpecified() {
           return fSpecified;
       }
   
   
       /**
  -     * [type definition anonymous]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-type_definition_anonymous>XML Schema Part 1: Structures [type definition anonymous]</a>
  -     * @return true if the {name} of the type definition is absent, otherwise false.
  -     */
  -    public boolean isTypeAnonymous() {
  -        return (fTypeDecl !=null)? fTypeDecl.getIsAnonymous():false;
  -    }
  -
  -    /**
  -     * [type definition name]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-type_definition_name>XML Schema Part 1: Structures [type definition name]</a>
  -     * @return The {name} of the type definition, if it is not absent.
  -     *         If it is absent, schema processors may, but need not,
  -     *         provide a value unique to the definition.
  -     */
  -    public String getTypeName() {
  -        return (fTypeDecl !=null)? fTypeDecl.getName():null;
  -    }
  -
  -    /**
  -     * [type definition namespace]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-member_type_definition_namespace>XML Schema Part 1: Structures [type definition namespace]</a>
  -     * @return The {target namespace} of the type definition.
  -     */
  -    public String getTypeNamespace() {
  -        return (fTypeDecl !=null)? fTypeDecl.getNamespace():null;
  -    }
  -
  -    /**
  -     * [type definition type]
  -     *
  -     *  @see <a href="http://www.w3.org/TR/xmlschema-1/#a-type_definition_type>XML Schema Part 1: Structures [type definition type]</a>
  -     *  @see <a href="http://www.w3.org/TR/xmlschema-1/#e-type_definition_type>XML Schema Part 1: Structures [type definition type]</a>
  -     *  @return simple or complex, depending on the type definition.
  -     */
  -    public short getTypeDefinitionType() {
  -        return XSTypeDecl.SIMPLE_TYPE;
  -    }
  -
  -    /**
        * Determines the extent to which the document has been validated
        *
        * @return return the [validation attempted] property. The possible values are
  @@ -235,18 +166,10 @@
        * A list of error codes generated from validation attempts.
        * Need to find all the possible subclause reports that need reporting
        *
  -     * @return Array of error codes
  +     * @return list of error codes
        */
  -    public String[] getErrorCodes() {
  -        // REVISIT: can we make it more efficient?
  -        int size = fErrorCodes.size();
  -        // copy errors from the list to an string array
  -        String[] errors = new String[size];
  -        for (int i = 0; i < size; i++) {
  -            errors[i] = (String)fErrorCodes.elementAt(i);
  -        }
  -        return errors;
  -
  +    public Enumeration getErrorCodes() {
  +        return fErrorCodes.elements();
       }
   
       // This is the only information we can provide in a pipeline.
  @@ -255,20 +178,34 @@
       }
   
       /**
  -     * REVISIT: temprory method to return the internal representation of
  -     * the type definition used to validate this attribute. This method
  -     * will be removed when we have full PSVI support.
  +     * An item isomorphic to the type definition used to validate this element.
  +     * 
  +     * @return  a type declaration
        */
  -    public XSTypeDecl getTypeDefinition() {
  +    public XSTypeDefinition getTypeDefinition() {
           return fTypeDecl;
       }
   
       /**
  -     * REVISIT: temprory method to return the internal representation of
  -     * the attribute declaration used to validate this attribute. This method
  -     * will be removed when we have full PSVI support.
  +     * If and only if that type definition is a simple type definition
  +     * with {variety} union, or a complex type definition whose {content type}
  +     * is a simple thype definition with {variety} union, then an item isomorphic
  +     * to that member of the union's {member type definitions} which actually
  +     * validated the element item's normalized value.
  +     * 
  +     * @return  a simple type declaration
  +     */
  +    public XSSimpleTypeDefinition getMemberTypeDefinition() {
  +        return fMemberType;
  +    }
  +
  +    /**
  +     * An item isomorphic to the attribute declaration used to validate
  +     * this attribute.
  +     * 
  +     * @return  an attribute declaration
        */
  -    public XSAttributeDecl getAttributeDecl() {
  +    public XSAttributeDeclaration getAttributeDeclaration() {
           return fDeclaration;
       }
   
  @@ -281,8 +218,8 @@
           fTypeDecl = null;
           fSpecified = true;
           fMemberType = null;
  -        fValidationAttempted = AttributePSVI.NO_VALIDATION;
  -        fValidity = AttributePSVI.UNKNOWN_VALIDITY;
  +        fValidationAttempted = AttributePSVI.VALIDATION_NONE;
  +        fValidity = AttributePSVI.VALIDITY_UNKNOWN;
           fErrorCodes.setSize(0);
           fValidationContext = null;
       }
  
  
  
  1.14      +37 -120   xml-xerces/java/src/org/apache/xerces/impl/xs/ElementPSVImpl.java
  
  Index: ElementPSVImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/ElementPSVImpl.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ElementPSVImpl.java	16 May 2002 18:25:54 -0000	1.13
  +++ ElementPSVImpl.java	30 May 2002 18:00:54 -0000	1.14
  @@ -59,10 +59,12 @@
   
   import org.apache.xerces.impl.dv.XSSimpleType;
   import org.apache.xerces.impl.xs.XSElementDecl;
  +import org.apache.xerces.impl.xs.util.EnumerationImpl;
   import org.apache.xerces.impl.xs.XSNotationDecl;
   import org.apache.xerces.xni.psvi.ElementPSVI;
  +import org.apache.xerces.impl.xs.psvi.*;
   
  -
  +import java.util.Enumeration;
   
   /**
    * Element PSV infoset augmentations implementation.
  @@ -102,10 +104,10 @@
       protected XSSimpleType fMemberType = null;
   
       /** validation attempted: none, partial, full */
  -    protected short fValidationAttempted = ElementPSVI.NO_VALIDATION;
  +    protected short fValidationAttempted = ElementPSVI.VALIDATION_NONE;
   
       /** validity: valid, invalid, unknown */
  -    protected short fValidity = ElementPSVI.UNKNOWN_VALIDITY;
  +    protected short fValidity = ElementPSVI.VALIDITY_UNKNOWN;
   
       /** error codes */
       protected String[] fErrorCodes = null;
  @@ -113,49 +115,17 @@
       /** validation context: could be QName or XPath expression*/
       protected String fValidationContext = null;
   
  -
       //
       // ElementPSVI methods
       //
   
       /**
  -     * [member type definition anonymous]
  -     * @ see <a href="http://www.w3.org/TR/xmlschema-1/#e-member_type_definition_anonymous>XML Schema Part 1: Structures [member type definition anonymous]</a>
  -     * @return true if the {name} of the actual member type definition is absent,
  -     *         otherwise false.
  -     */
  -    public boolean  isMemberTypeAnonymous() {
  -        return (fMemberType !=null)? fMemberType.getIsAnonymous():false;
  -    }
  -
  -
  -    /**
  -     * [member type definition name]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-member_type_definition_name>XML Schema Part 1: Structures [member type definition name]</a>
  -     * @return The {name} of the actual member type definition, if it is not absent.
  -     *         If it is absent, schema processors may, but need not, provide a
  -     *         value unique to the definition.
  -     */
  -    public String   getMemberTypeName() {
  -        return (fMemberType !=null)? fMemberType.getName():null;
  -    }
  -
  -    /**
  -     * [member type definition namespace]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-member_type_definition_namespace>XML Schema Part 1: Structures [member type definition namespace]</a>
  -     * @return The {target namespace} of the actual member type definition.
  -     */
  -    public String   getMemberTypeNamespace() {
  -        return (fMemberType !=null)? fMemberType.getNamespace():null;
  -    }
  -
  -    /**
        * [schema default]
        *
        * @return The canonical lexical representation of the declaration's {value constraint} value.
        * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_default>XML Schema Part 1: Structures [schema default]</a>
        */
  -    public String   getSchemaDefault() {
  +    public String getSchemaDefault() {
           Object dValue = null;
           if( fDeclaration !=null ) {
               dValue = fDeclaration.fDefault;
  @@ -179,51 +149,10 @@
        * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_specified">XML Schema Part 1: Structures [schema specified]</a>
        * @return false value was specified in schema, true value comes from the infoset
        */
  -    public boolean isSpecified() {
  +    public boolean getIsSchemaSpecified() {
           return fSpecified;
       }
   
  -
  -    /**
  -     * [type definition anonymous]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-type_definition_anonymous>XML Schema Part 1: Structures [type definition anonymous]</a>
  -     * @return true if the {name} of the type definition is absent, otherwise false.
  -     */
  -    public boolean isTypeAnonymous() {
  -        return (fTypeDecl !=null)? fTypeDecl.getIsAnonymous():false;
  -    }
  -
  -    /**
  -     * [type definition name]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-type_definition_name>XML Schema Part 1: Structures [type definition name]</a>
  -     * @return The {name} of the type definition, if it is not absent.
  -     *         If it is absent, schema processors may, but need not,
  -     *         provide a value unique to the definition.
  -     */
  -    public String getTypeName() {
  -        return (fTypeDecl !=null)? fTypeDecl.getName():null;
  -    }
  -
  -    /**
  -     * [type definition namespace]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-member_type_definition_namespace>XML Schema Part 1: Structures [type definition namespace]</a>
  -     * @return The {target namespace} of the type definition.
  -     */
  -    public String getTypeNamespace() {
  -        return (fTypeDecl !=null)? fTypeDecl.getNamespace():null;
  -    }
  -
  -    /**
  -     * [type definition type]
  -     *
  -     *  @see <a href="http://www.w3.org/TR/xmlschema-1/#a-type_definition_type>XML Schema Part 1: Structures [type definition type]</a>
  -     *  @see <a href="http://www.w3.org/TR/xmlschema-1/#e-type_definition_type>XML Schema Part 1: Structures [type definition type]</a>
  -     *  @return simple or complex, depending on the type definition.
  -     */
  -    public short getTypeDefinitionType() {
  -        return (fTypeDecl !=null)? fTypeDecl.getTypeCategory():XSTypeDecl.COMPLEX_TYPE;
  -    }
  -
       /**
        * Determines the extent to which the document has been validated
        *
  @@ -251,9 +180,10 @@
        *
        * @return Array of error codes
        */
  -    public String[] getErrorCodes() {
  -        return fErrorCodes;
  -
  +    public Enumeration getErrorCodes() {
  +        if (fErrorCodes == null)
  +            return null;
  +        return new EnumerationImpl(fErrorCodes, fErrorCodes.length);
       }
   
   
  @@ -267,61 +197,48 @@
        * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-nil>XML Schema Part 1: Structures [nil]</a>
        * @return true if clause 3.2 of Element Locally Valid (Element) (3.3.4) above is satisfied, otherwise false
        */
  -    public boolean isNil() {
  +    public boolean getIsNil() {
           return fNil;
       }
   
       /**
  -     * [notation public]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-notation_public>XML Schema Part 1: Structures [notation public]</a>
  +     * [notation] 
        * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-notation>XML Schema Part 1: Structures [notation]</a>
  -     * @return The value of the {public identifier} of that notation declaration.
  -     */
  -    public String getNotationPublicId() {
  -        return (fNotation!=null)?fNotation.fPublicId:null;
  -    }
  -
  -    /**
  -     * [notation system]
  -     *
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-notation_system>XML Schema Part 1: Structures [notation system]</a>
  -     * @return The value of the {system identifier} of that notation declaration.
  +     * @return The notation declaration. 
        */
  -    public String getNotationSystemId() {
  -        return (fNotation!=null)?fNotation.fSystemId:null;
  +    public XSNotationDeclaration getNotation() {
  +        return fNotation;
       }
   
       /**
  -     * [schema namespace]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#nsi-schema_namespace>XML Schema Part 1: Structures [schema namespace]</a>
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_information>XML Schema Part 1: Structures [schema information]</a>
  -     * @return A namespace name or absent.
  +     * An item isomorphic to the type definition used to validate this element.
        * 
  -     * REVISIT: this mehtod is wrongfully designed.
  -     * The PSVI item for the validation root has a [schema information] property,
  -     * which has a list of [namespace schema information], which in turn has
  -     * properties [schema namespace/components/documents].
  +     * @return  a type declaration
        */
  -    public String getSchemaNamespace() {
  -        // REVISIT: should we create component for schema-information item?
  -        return (fDeclaration !=null)? fDeclaration.fTargetNamespace:null;
  +    public XSTypeDefinition getTypeDefinition() {
  +        return fTypeDecl;
       }
  -
  +    
       /**
  -     * REVISIT: temprory method to return the internal representation of
  -     * the type definition used to validate this element. This method
  -     * will be removed when we have full PSVI support.
  +     * If and only if that type definition is a simple type definition
  +     * with {variety} union, or a complex type definition whose {content type}
  +     * is a simple thype definition with {variety} union, then an item isomorphic
  +     * to that member of the union's {member type definitions} which actually
  +     * validated the element item's normalized value.
  +     * 
  +     * @return  a simple type declaration
        */
  -    public XSTypeDecl getTypeDefinition() {
  -        return fTypeDecl;
  +    public XSSimpleTypeDefinition getMemberTypeDefinition() {
  +        return fMemberType;
       }
   
       /**
  -     * REVISIT: temprory method to return the internal representation of
  -     * the element declaration used to validate this element. This method
  -     * will be removed when we have full PSVI support.
  +     * An item isomorphic to the element declaration used to validate
  +     * this element.
  +     * 
  +     * @return  an element declaration
        */
  -    public XSElementDecl getElementDecl() {
  +    public XSElementDeclaration getElementDeclaration() {
           return fDeclaration;
       }
   
  @@ -335,8 +252,8 @@
           fSpecified = true;
           fNotation = null;
           fMemberType = null;
  -        fValidationAttempted = ElementPSVI.NO_VALIDATION;
  -        fValidity = ElementPSVI.UNKNOWN_VALIDITY;
  +        fValidationAttempted = ElementPSVI.VALIDATION_NONE;
  +        fValidity = ElementPSVI.VALIDITY_UNKNOWN;
           fErrorCodes = null;
           fValidationContext = null;
           fNormalizedValue = null;
  
  
  
  1.67      +12 -11    xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
  
  Index: XMLSchemaValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- XMLSchemaValidator.java	27 May 2002 23:05:41 -0000	1.66
  +++ XMLSchemaValidator.java	30 May 2002 18:00:54 -0000	1.67
  @@ -135,7 +135,7 @@
    * @author Elena Litani IBM
    * @author Andy Clark IBM
    * @author Neeraj Bajaj, Sun Microsystems, inc.
  - * @version $Id: XMLSchemaValidator.java,v 1.66 2002/05/27 23:05:41 neilg Exp $
  + * @version $Id: XMLSchemaValidator.java,v 1.67 2002/05/30 18:00:54 sandygao Exp $
    */
   public class XMLSchemaValidator
                implements XMLComponent, XMLDocumentFilter, FieldActivator, DOMRevalidationHandler {
  @@ -603,6 +603,7 @@
               fCurrentPSVI.fTypeDecl = type;
               fCurrentPSVI.fNotation = notation;
               fCurrentPSVI.fValidationContext = vContext;
  +
               if (!fSchemaElementDefault || fDefaultValue == null) {
                   fDocumentHandler.emptyElement(element, attributes, modifiedAugs);
               } else {
  @@ -2148,14 +2149,14 @@
           // PSVI: validation attempted
           if (fElementDepth <= fPartialValidationDepth) {
               // the element had child with a content skip.
  -            fCurrentPSVI.fValidationAttempted = ElementPSVI.PARTIAL_VALIDATION;
  +            fCurrentPSVI.fValidationAttempted = ElementPSVI.VALIDATION_PARTIAL;
               if (fElementDepth == fPartialValidationDepth) {
                   // set depth to the depth of the parent
                   fPartialValidationDepth--;
               }
           }
           else {
  -            fCurrentPSVI.fValidationAttempted = ElementPSVI.FULL_VALIDATION;
  +            fCurrentPSVI.fValidationAttempted = ElementPSVI.VALIDATION_FULL;
           }
   
   
  @@ -2192,8 +2193,8 @@
           // PSVI: error codes
           fCurrentPSVI.fErrorCodes = errors;
           // PSVI: validity
  -        fCurrentPSVI.fValidity = (errors == null) ? ElementPSVI.VALID_VALIDITY
  -                                                  : ElementPSVI.INVALID_VALIDITY;
  +        fCurrentPSVI.fValidity = (errors == null) ? ElementPSVI.VALIDITY_VALID
  +                                                  : ElementPSVI.VALIDITY_INVALID;
   
           fDefaultValue = defaultValue;
   
  @@ -2565,7 +2566,7 @@
                               reportSchemaError("cvc-complex-type.5.1", new Object[]{element.rawname, currDecl.fName, wildcardIDName});
   
                               // PSVI: attribute is invalid, record errors
  -                            attrPSVI.fValidity = AttributePSVI.INVALID_VALIDITY;
  +                            attrPSVI.fValidity = AttributePSVI.VALIDITY_INVALID;
                               attrPSVI.addErrorCode("cvc-complex-type.5.1");
                           }
                           else
  @@ -2603,8 +2604,8 @@
           attrPSVI.fTypeDecl = attDV;
       
           // PSVI: validation attempted:
  -        attrPSVI.fValidationAttempted = AttributePSVI.FULL_VALIDATION;
  -        attrPSVI.fValidity = AttributePSVI.VALID_VALIDITY;
  +        attrPSVI.fValidationAttempted = AttributePSVI.VALIDATION_FULL;
  +        attrPSVI.fValidity = AttributePSVI.VALIDITY_VALID;
       
           Object actualValue = null;
           try {
  @@ -2630,7 +2631,7 @@
           catch (InvalidDatatypeValueException idve) {
       
               // PSVI: attribute is invalid, record errors
  -            attrPSVI.fValidity = AttributePSVI.INVALID_VALIDITY;
  +            attrPSVI.fValidity = AttributePSVI.VALIDITY_INVALID;
               attrPSVI.addErrorCode("cvc-attribute.3");
               reportSchemaError(idve.getKey(), idve.getArgs());
               reportSchemaError("cvc-attribute.3", new Object[]{element.rawname, fTempQName.rawname, attrValue});
  @@ -2648,7 +2649,7 @@
               if (!attDV.isEqual(actualValue, currDecl.fDefault.actualValue)){
       
                   // PSVI: attribute is invalid, record errors
  -                attrPSVI.fValidity = AttributePSVI.INVALID_VALIDITY;
  +                attrPSVI.fValidity = AttributePSVI.VALIDITY_INVALID;
                   attrPSVI.addErrorCode("cvc-attribute.4");
                   reportSchemaError("cvc-attribute.4", new Object[]{element.rawname, fTempQName.rawname, attrValue});
               }
  @@ -2659,7 +2660,7 @@
               currUse != null && currUse.fConstraintType == XSConstants.VC_FIXED) {
               if (!attDV.isEqual(actualValue, currUse.fDefault.actualValue)){
                   // PSVI: attribute is invalid, record errors
  -                attrPSVI.fValidity = AttributePSVI.INVALID_VALIDITY;
  +                attrPSVI.fValidity = AttributePSVI.VALIDITY_INVALID;
                   attrPSVI.addErrorCode("cvc-complex-type.3.1");
                   reportSchemaError("cvc-complex-type.3.1", new Object[]{element.rawname, fTempQName.rawname, attrValue});
               }
  
  
  
  1.57      +6 -6      xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java
  
  Index: AbstractDOMParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- AbstractDOMParser.java	24 May 2002 00:00:54 -0000	1.56
  +++ AbstractDOMParser.java	30 May 2002 18:00:54 -0000	1.57
  @@ -116,7 +116,7 @@
    * @author Andy Clark, IBM
    * @author Elena Litani, IBM
    *
  - * @version $Id: AbstractDOMParser.java,v 1.56 2002/05/24 00:00:54 elena Exp $
  + * @version $Id: AbstractDOMParser.java,v 1.57 2002/05/30 18:00:54 sandygao Exp $
    */
   public class AbstractDOMParser extends AbstractXMLDocumentParser{
   
  @@ -845,7 +845,7 @@
                   if (fNormalizeData) {
                       // If validation is not attempted, the SchemaNormalizedValue will be null. 
                       // We shouldn't take the normalized value in this case.
  -                    if (attrPSVI != null && attrPSVI.getValidationAttempted() == AttributePSVI.FULL_VALIDATION) {
  +                    if (attrPSVI != null && attrPSVI.getValidationAttempted() == AttributePSVI.VALIDATION_FULL) {
                           attrValue = attrPSVI.getSchemaNormalizedValue();
                       }
   
  @@ -862,8 +862,8 @@
                       boolean specified = attributes.isSpecified(i);
                       attrImpl.setSpecified(specified);
                       // Identifier registration
  -                    // try to retrieve XML Schema attribute declaration 
  -                    XSAttributeDecl xsDecl = (attrPSVI !=null)? attrPSVI.getAttributeDecl():null;
  +                    // try to retrieve XML Schema attribute declaration
  +                    XSAttributeDecl xsDecl = (XSAttributeDecl)((attrPSVI!=null)?attrPSVI.getAttributeDeclaration():null);
                       if (attributes.getType(i).equals("ID") || 
                           (xsDecl !=null && xsDecl.fType.isIDType())) {
                           ((ElementImpl) el).setIdAttributeNode(attr);
  @@ -892,7 +892,7 @@
                   if (fNormalizeData) {
                       // If validation is not attempted, the SchemaNormalizedValue will be null. 
                       // We shouldn't take the normalized value in this case.
  -                    if (attrPSVI != null && attrPSVI.getValidationAttempted() == AttributePSVI.FULL_VALIDATION) {
  +                    if (attrPSVI != null && attrPSVI.getValidationAttempted() == AttributePSVI.VALIDATION_FULL) {
                           attrValue = attrPSVI.getSchemaNormalizedValue();
                       }
   
  @@ -904,7 +904,7 @@
                                                       attributes.isSpecified(i));
                   // identifier registration
                   // try to retrieve XML Schema attribute declaration 
  -                XSAttributeDecl xsDecl = (attrPSVI !=null)? attrPSVI.getAttributeDecl():null;
  +                XSAttributeDecl xsDecl = (XSAttributeDecl)((attrPSVI!=null)?attrPSVI.getAttributeDeclaration():null);
   
                   if (attributes.getType(i).equals("ID") || 
                       (xsDecl !=null && xsDecl.fType.isIDType())) {
  
  
  
  1.29      +2 -2      xml-xerces/java/src/org/apache/xerces/parsers/AbstractSAXParser.java
  
  Index: AbstractSAXParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractSAXParser.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- AbstractSAXParser.java	13 May 2002 18:51:01 -0000	1.28
  +++ AbstractSAXParser.java	30 May 2002 18:00:54 -0000	1.29
  @@ -111,7 +111,7 @@
    * @author Arnaud Le Hors, IBM
    * @author Andy Clark, IBM
    *
  - * @version $Id: AbstractSAXParser.java,v 1.28 2002/05/13 18:51:01 sandygao Exp $
  + * @version $Id: AbstractSAXParser.java,v 1.29 2002/05/30 18:00:54 sandygao Exp $
    */
   public abstract class AbstractSAXParser
       extends AbstractXMLDocumentParser
  @@ -426,7 +426,7 @@
                       if (fNormalizeData) {
                           AttributePSVI attrPSVI = (AttributePSVI)attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI);
                           if (attrPSVI != null &&
  -                            attrPSVI.getValidationAttempted() == AttributePSVI.FULL_VALIDATION) {
  +                            attrPSVI.getValidationAttempted() == AttributePSVI.VALIDATION_FULL) {
                               attributes.setValue(i, attrPSVI.getSchemaNormalizedValue());
                           }
                       }
  
  
  
  1.3       +17 -0     xml-xerces/java/src/org/apache/xerces/xni/psvi/AttributePSVI.java
  
  Index: AttributePSVI.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/xni/psvi/AttributePSVI.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AttributePSVI.java	29 Jan 2002 01:15:20 -0000	1.2
  +++ AttributePSVI.java	30 May 2002 18:00:55 -0000	1.3
  @@ -57,5 +57,22 @@
   
   package org.apache.xerces.xni.psvi;
   
  +import org.apache.xerces.impl.xs.psvi.*;
  +
  +/**
  + * Represent a PSVI item for one attribute information item.
  + *
  + * @author Elena Litani, IBM
  + * @version $Id: AttributePSVI.java,v 1.3 2002/05/30 18:00:55 sandygao Exp $
  + */
   public interface AttributePSVI extends ItemPSVI{
  +
  +    /**
  +     * An item isomorphic to the attribute declaration used to validate
  +     * this attribute.
  +     * 
  +     * @return  an attribute declaration
  +     */
  +    public XSAttributeDeclaration getAttributeDeclaration();
  +    
   }
  
  
  
  1.4       +17 -29    xml-xerces/java/src/org/apache/xerces/xni/psvi/ElementPSVI.java
  
  Index: ElementPSVI.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/xni/psvi/ElementPSVI.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ElementPSVI.java	29 Jan 2002 01:15:20 -0000	1.3
  +++ ElementPSVI.java	30 May 2002 18:00:55 -0000	1.4
  @@ -57,41 +57,29 @@
   
   package org.apache.xerces.xni.psvi;
   
  -public interface ElementPSVI extends ItemPSVI {
  -
  -    /**
  -     * [nil] 
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-nil>XML Schema Part 1: Structures [nil]</a>
  -     * @return true if clause 3.2 of Element Locally Valid (Element) (3.3.4) above is satisfied, otherwise false 
  -     */
  -    public boolean isNil();
  -
  -
  -    /**
  -     * [notation public] 
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-notation_public>XML Schema Part 1: Structures [notation public]</a>
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-notation>XML Schema Part 1: Structures [notation]</a>
  -     * @return The value of the {public identifier} of that notation declaration. 
  -     */
  -    public String getNotationPublicId();
  +import org.apache.xerces.impl.xs.psvi.*;
   
  +/**
  + * Represent a PSVI item for one element information item.
  + *
  + * @author Elena Litani, IBM
  + * @version $Id: ElementPSVI.java,v 1.4 2002/05/30 18:00:55 sandygao Exp $
  + */
  +public interface ElementPSVI extends ItemPSVI {
   
       /**
  -     * [notation system] 
  +     * An item isomorphic to the element declaration used to validate
  +     * this element.
        * 
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-notation_system>XML Schema Part 1: Structures [notation system]</a>
  -     * @return The value of the {system identifier} of that notation declaration. 
  +     * @return  an element declaration
        */
  -    public String getNotationSystemId();
  -
  +    public XSElementDeclaration getElementDeclaration();
  +    
       /**
  -     *  
  -     * [schema namespace]
  -     * 
  -     * @return A namespace name or absent.
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#nsi-schema_namespace>XML Schema Part 1: Structures [schema namespace]</a>
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_information>XML Schema Part 1: Structures [schema information]</a>
  +     * [notation] 
  +     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-notation">XML Schema Part 1: Structures [notation]</a>
  +     * @return The notation declaration. 
        */
  -    public String getSchemaNamespace();
  +    public XSNotationDeclaration getNotation();
   
   }
  
  
  
  1.5       +55 -94    xml-xerces/java/src/org/apache/xerces/xni/psvi/ItemPSVI.java
  
  Index: ItemPSVI.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/xni/psvi/ItemPSVI.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ItemPSVI.java	29 Jan 2002 01:15:20 -0000	1.4
  +++ ItemPSVI.java	30 May 2002 18:00:55 -0000	1.5
  @@ -57,12 +57,14 @@
   
   package org.apache.xerces.xni.psvi;
   
  -import org.apache.xerces.xni.QName;
  +import org.apache.xerces.impl.xs.psvi.*;
  +import java.util.Enumeration;
  +
   /**
  - *
  + * Represent a PSVI item for one element or one attribute information item.
    *
    * @author Elena Litani, IBM
  - *
  + * @version $Id: ItemPSVI.java,v 1.5 2002/05/30 18:00:55 sandygao Exp $
    */
   
   public interface ItemPSVI {
  @@ -71,150 +73,109 @@
       been performed or that a strict assessment of validity could 
       not be performed  
       */
  -    public static final short UNKNOWN_VALIDITY               = 0;
  +    public static final short VALIDITY_UNKNOWN               = 0;
   
       /** Validity value indicating that validation has been strictly
        assessed and the element in question is invalid according to the 
        rules of schema validation.
       */
  -    public static final short INVALID_VALIDITY               = 1;
  +    public static final short VALIDITY_INVALID               = 1;
   
       /** Validity value indicating that validation has been strictly 
        assessed and the element in question is valid according to the rules 
        of schema validation.
        */
  -    public static final short VALID_VALIDITY                 = 2;
  +    public static final short VALIDITY_VALID                 = 2;
   
       /** Validation status indicating that schema validation has been 
        performed and the element in question has specifically been skipped.   
        */
  -    public static final short NO_VALIDATION                  = 1;
  +    public static final short VALIDATION_NONE                = 0;
   
       /** Validation status indicating that schema validation has been 
       performed on the element in question under the rules of lax validation.
       */
  -    public static final short PARTIAL_VALIDATION             = 2;
  +    public static final short VALIDATION_PARTIAL             = 1;
   
       /**  Validation status indicating that full schema validation has been 
       performed on the element.  */
  -    public static final short FULL_VALIDATION                = 3;
  +    public static final short VALIDATION_FULL                = 2;
   
       /**
  -     * [member type definition anonymous]
  -     * @ see <a href="http://www.w3.org/TR/xmlschema-1/#e-member_type_definition_anonymous">XML Schema Part 1: Structures [member type definition anonymous]</a>
  -     * @return true if the {name} of the actual member type definition is absent, 
  -     *         otherwise false.
  +     * [validation context]
  +     * // REVISIT: what the return type should be?
  +     *             Should we return QName/XPath/ or element info item..?
  +     * 
  +     * @return The nearest ancestor element information item with a [schema information] property
  +     *         (or this element item itself if it has such a property)
  +     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-validation_context">XML Schema Part 1: Structures [validation context]</a>
        */
  -    public boolean isMemberTypeAnonymous();
  +    public String getValidationContext();
   
       /**
  -     * [member type definition name]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-member_type_definition_name">XML Schema Part 1: Structures [member type definition name]</a>
  -     * @return The {name} of the actual member type definition, if it is not absent.
  -     *         If it is absent, schema processors may, but need not, provide a
  -     *         value unique to the definition.
  +     * Determine the validity of the node with respect 
  +     * to the validation being attempted
  +     * 
  +     * @return return the [validity] property. Possible values are: 
  +     *         VALIDITY_UNKNOWN, VALIDITY_INVALID, VALIDITY_VALID
        */
  -    public String getMemberTypeName();
  +    public short getValidity();
   
       /**
  -     * [member type definition namespace]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-member_type_definition_namespace">XML Schema Part 1: Structures [member type definition namespace]</a>
  -     * @return The {target namespace} of the actual member type definition.
  +     * Determines the extent to which the document has been validated
  +     * 
  +     * @return return the [validation attempted] property. The possible values are 
  +     *         VALIDATION_NONE, VALIDATION_PARTIAL and VALIDATION_FULL
        */
  -    public String getMemberTypeNamespace();
  +    public short getValidationAttempted();
   
       /**
  -     * [schema default]
  +     * A list of error codes generated from validation attempts. 
  +     * Need to find all the possible subclause reports that need reporting
        * 
  -     * @return The canonical lexical representation of the declaration's {value constraint} value.
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_default">XML Schema Part 1: Structures [schema default]</a>
  +     * @return list of error codes
        */
  -    public String getSchemaDefault();
  -
  +    public Enumeration getErrorCodes();
  +    
       /**
        * [schema normalized value] 
        * 
  -     * 
        * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_normalized_value">XML Schema Part 1: Structures [schema normalized value]</a>
        * @return the normalized value of this item after validation
        */
       public String getSchemaNormalizedValue();
   
       /**
  -     * [schema specified] 
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_specified">XML Schema Part 1: Structures [schema specified]</a>
  -     * @return false - value was specified in schema, true - value comes from the infoset
  -     */
  -    public boolean isSpecified();
  -
  -
  -    /**
  -     * [type definition anonymous]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-type_definition_anonymous">XML Schema Part 1: Structures [type definition anonymous]</a>
  -     * @return true if the {name} of the type definition is absent, otherwise false.
  -     */
  -    public boolean isTypeAnonymous();
  -
  -    /**
  -     * [type definition name]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-type_definition_name">XML Schema Part 1: Structures [type definition name]</a>
  -     * @return The {name} of the type definition, if it is not absent.
  -     *         If it is absent, schema processors may, but need not,
  -     *         provide a value unique to the definition.
  -     */
  -    public String getTypeName();
  -
  -    /**
  -     * [type definition namespace]
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-member_type_definition_namespace">XML Schema Part 1: Structures [type definition namespace]</a>
  -     * @return The {target namespace} of the type definition.
  -     */
  -    public String getTypeNamespace();
  -
  -    /**
  -     * [type definition type] 
  -     * 
  -     *  @see <a href="http://www.w3.org/TR/xmlschema-1/#a-type_definition_type">XML Schema Part 1: Structures [type definition type]</a>
  -     *  @see <a href="http://www.w3.org/TR/xmlschema-1/#e-type_definition_type">XML Schema Part 1: Structures [type definition type]</a>
  -     * @return simple or complex, depending on the type definition. 
  -     */
  -    public short getTypeDefinitionType();
  -
  -    /**
  -     * Determines the extent to which the document has been validated
  +     * An item isomorphic to the type definition used to validate this element.
        * 
  -     * @return return the [validation attempted] property. The possible values are 
  -     *         NO_VALIDATION, PARTIAL_VALIDATION and FULL_VALIDATION
  +     * @return  a type declaration
        */
  -    public short getValidationAttempted();
  -
  +    public XSTypeDefinition getTypeDefinition();
  +    
       /**
  -     * Determine the validity of the node with respect 
  -     * to the validation being attempted
  +     * If and only if that type definition is a simple type definition
  +     * with {variety} union, or a complex type definition whose {content type}
  +     * is a simple thype definition with {variety} union, then an item isomorphic
  +     * to that member of the union's {member type definitions} which actually
  +     * validated the element item's normalized value.
        * 
  -     * @return return the [validity] property. Possible values are: 
  -     *         UNKNOWN_VALIDITY, INVALID_VALIDITY, VALID_VALIDITY
  +     * @return  a simple type declaration
        */
  -    public short getValidity();
  -
  +    public XSSimpleTypeDefinition getMemberTypeDefinition();
  +    
       /**
  -     * A list of error codes generated from validation attempts. 
  -     * Need to find all the possible subclause reports that need reporting
  +     * [schema default]
        * 
  -     * @return Array of error codes
  +     * @return The canonical lexical representation of the declaration's {value constraint} value.
  +     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_default">XML Schema Part 1: Structures [schema default]</a>
        */
  -    public String[] getErrorCodes();
  -
  +    public String getSchemaDefault();
   
       /**
  -     * [validation context]
  -     * // REVISIT: what the return type should be?
  -     *             Should we return QName/XPath/ or element info item..?
  -     * 
  -     * @return The nearest ancestor element information item with a [schema information] property
  -     *         (or this element item itself if it has such a property)
  -     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-validation_context">XML Schema Part 1: Structures [validation context]</a>
  +     * [schema specified] 
  +     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_specified">XML Schema Part 1: Structures [schema specified]</a>
  +     * @return true - value was specified in schema, false - value comes from the infoset
        */
  -    public String getValidationContext();
  +    public boolean getIsSchemaSpecified();
   
   }
  
  
  

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