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 2001/08/27 21:03:46 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl/v2 XSDHandler.java XSDAbstractParticleTraverser.java XSAttributeChecker.java

sandygao    01/08/27 12:03:46

  Modified:    java/src/org/apache/xerces/impl/v2 XSDHandler.java
                        XSDAbstractParticleTraverser.java
                        XSAttributeChecker.java
  Log:
  Trying to make things compile.
  
  Revision  Changes    Path
  1.5       +2 -1      xml-xerces/java/src/org/apache/xerces/impl/v2/XSDHandler.java
  
  Index: XSDHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/v2/XSDHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XSDHandler.java	2001/08/27 15:21:37	1.4
  +++ XSDHandler.java	2001/08/27 19:03:46	1.5
  @@ -66,7 +66,6 @@
   import org.apache.xerces.xni.parser.XMLInputSource;
   import org.apache.xerces.util.SymbolTable;
   import org.apache.xerces.util.XMLManipulator;
  -//import GrammarResolver;???
   
   import org.w3c.dom.Document;
   import org.w3c.dom.Attr;
  @@ -178,6 +177,8 @@
           fErrorReporter = errorReporter;
           fGrammarResolver = gResolver;
           fSymbolTable = symbolTable;
  +        //REVISIT: get schema grammar instead of validator factory
  +        //SchemaGrammar fGrammar4Schema = fGrammarResolver.getGrammar(SchemaSymbols.URI_SCHEMAFORSCHEMA);
           fDatatypeRegistry = new DatatypeValidatorFactoryImpl();
           fDatatypeRegistry.expandRegistryToFullSchemaSet();
           createTraversers();
  
  
  
  1.4       +1 -0      xml-xerces/java/src/org/apache/xerces/impl/v2/XSDAbstractParticleTraverser.java
  
  Index: XSDAbstractParticleTraverser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/v2/XSDAbstractParticleTraverser.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XSDAbstractParticleTraverser.java	2001/08/27 15:21:36	1.3
  +++ XSDAbstractParticleTraverser.java	2001/08/27 19:03:46	1.4
  @@ -124,6 +124,7 @@
       int traverseChoice (Element choiceDecl,
                           XSDocumentInfo schemaDoc,
                           SchemaGrammar grammar) {
  +        return -1;
       }
   
   
  
  
  
  1.3       +22 -21    xml-xerces/java/src/org/apache/xerces/impl/v2/XSAttributeChecker.java
  
  Index: XSAttributeChecker.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/v2/XSAttributeChecker.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XSAttributeChecker.java	2001/08/27 15:21:36	1.2
  +++ XSAttributeChecker.java	2001/08/27 19:03:46	1.3
  @@ -61,13 +61,14 @@
   import org.w3c.dom.*;
   import org.apache.xerces.impl.v2.datatypes.*;
   import org.apache.xerces.impl.XMLErrorReporter;
  +import org.apache.xerces.util.XMLManipulator;
   /*import org.apache.xerces.validators.common.XMLAttributeDecl;
   import org.apache.xerces.validators.common.GrammarResolver;
   import org.apache.xerces.validators.common.Grammar;
   */
   
   /**
  - * @version $Id: XSAttributeChecker.java,v 1.2 2001/08/27 15:21:36 sandygao Exp $
  + * @version $Id: XSAttributeChecker.java,v 1.3 2001/08/27 19:03:46 sandygao Exp $
    */
   
   public class XSAttributeChecker {
  @@ -362,7 +363,6 @@
   
           // step 4: for each element, make a list of possible attributes
           Hashtable attrList;
  -        Object[] attrArray;
           OneElement oneEle;
   
           // for element "attribute" - global
  @@ -896,6 +896,7 @@
   
       public void reset() {
           fIdDefs.clear();
  +        // REVISIT: set new error reporter?
           //???fErrorReporter = null;
           fNonSchemaAttrs.clear();
       }
  @@ -904,7 +905,7 @@
       // @param: element    - which element to check
       // @param: isGlobal   - whether a child of <schema> or <redefine>
       // @return: Hashtable - list of attributes and values
  -    public Hashtable checkAttributes(Element element, boolean isGlobal) throws Exception {
  +    public Hashtable checkAttributes(Element element, boolean isGlobal) {
           if (element == null)
               return null;
   
  @@ -912,11 +913,11 @@
           // G_ for global;
           // LN_ for local + name;
           // LR_ for local + ref;
  -        String elName = element.getLocalName(), name;
  +        String elName = XMLManipulator.getLocalName(element), name;
           if (isGlobal) {
               name = PRE_GLOBAL + elName;
           } else {
  -            if (element.getAttributeNode(SchemaSymbols.ATT_REF) == null)
  +            if (XMLManipulator.getAttr(element, SchemaSymbols.ATT_REF) == null)
                   name = PRE_LOC_NAME + elName;
               else
                   name = PRE_LOC_REF + elName;
  @@ -934,23 +935,23 @@
           Hashtable attrList = oneEle.attrList;
   
           // traverse all attributes
  -        NamedNodeMap attrs = element.getAttributes();
  +        Attr[] attrs = XMLManipulator.getAttrs(element);
           Attr sattr = null;
  -        int i = 0;
  -        while ((sattr = (Attr)attrs.item(i++)) != null) {
  +        for (int i = 0; i < attrs.length; i++) {
  +            sattr = attrs[i++];
               // get the attribute name/value
  -            String attrName = sattr.getName();
  -            String attrVal = sattr.getValue();
  +            String attrName = XMLManipulator.getLocalName(sattr);
  +            String attrVal = XMLManipulator.getValue(sattr);
   
               // skip anything starts with x/X m/M l/L ???
               // simply put their values in the return hashtable
               if (attrName.toLowerCase().startsWith("xml")) {
  -                attrValues.put(attrName, new Object[] {sattr.getValue(), Boolean.FALSE});
  +                attrValues.put(attrName, new Object[] {attrVal, Boolean.FALSE});
                   continue;
               }
   
               // for attributes with namespace prefix
  -            String attrURI = sattr.getNamespaceURI();
  +            String attrURI = XMLManipulator.getNamespaceURI(sattr);
               if (attrURI != null && attrURI.length() != 0) {
                   // attributes with schema namespace are not allowed
                   // and not allowed on "document" and "appInfo"
  @@ -964,7 +965,7 @@
                       // schema traversal (because it's "lax")
                       attrValues.put(attrName,
                                      new Object[] {attrVal, Boolean.FALSE});
  -                    String attrRName = attrURI + "," + sattr.getLocalName();
  +                    String attrRName = attrURI + "," + attrName;
                       Vector values = (Vector)fNonSchemaAttrs.get(attrRName);
                       if (values == null) {
                           values = new Vector();
  @@ -1016,12 +1017,12 @@
           }
   
           // traverse all required attributes
  -        Object[] reqAttrs = oneEle.attrArray;
  -        for (i = 0; i < reqAttrs.length; i++) {
  -            OneAttr oneAttr = (OneAttr)reqAttrs[i];
  +        OneAttr[] reqAttrs = oneEle.attrArray;
  +        for (int i = 0; i < reqAttrs.length; i++) {
  +            OneAttr oneAttr = reqAttrs[i];
   
               // if the attribute appreared, skip to the next one
  -            if (element.getAttributeNode(oneAttr.name) != null)
  +            if (XMLManipulator.getAttr(element, oneAttr.name) != null)
                   continue;
   
               // if the attribute is required, report an error
  @@ -1206,7 +1207,7 @@
       }
   
       // report an error. copied from TraverseSchema
  -    private void reportSchemaError(String key, Object args[]) throws Exception {
  +    private void reportSchemaError(String key, Object args[]) {
           if (fErrorReporter == null) {
               System.out.println("__TraverseSchemaError__ : " + key);
               for (int i=0; i< args.length ; i++) {
  @@ -1333,7 +1334,7 @@
       // the list of attributes that can appear in one element
       public Hashtable attrList;
       // the array of attributes that can appear in one element
  -    public Object[] attrArray;
  +    public OneAttr[] attrArray;
       // does this element allow attributes from non-schema namespace
       public boolean allowNonSchemaAttr;
   
  @@ -1345,10 +1346,10 @@
           this.attrList = attrList;
   
           int count = attrList.size();
  -        this.attrArray = new Object[count];
  +        this.attrArray = new OneAttr[count];
           Enumeration enum = attrList.elements();
           for (int i = 0; i < count; i++)
  -            this.attrArray[i] = enum.nextElement();
  +            this.attrArray[i] = (OneAttr)enum.nextElement();
   
           this.allowNonSchemaAttr = allowNonSchemaAttr;
       }
  
  
  

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