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/02/18 23:30:26 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl/xs/util SimpleLocator.java

sandygao    02/02/18 14:30:26

  Modified:    java/src/org/apache/xerces/impl/xs SchemaGrammar.java
                        XSConstraints.java
               java/src/org/apache/xerces/impl/xs/traversers
                        XSDComplexTypeTraverser.java XSDGroupTraverser.java
                        XSDHandler.java
  Added:       java/src/org/apache/xerces/impl/xs/util SimpleLocator.java
  Log:
  Now we have line/column numbers for all schema errors!
  
  Revision  Changes    Path
  1.12      +52 -11    xml-xerces/java/src/org/apache/xerces/impl/xs/SchemaGrammar.java
  
  Index: SchemaGrammar.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/SchemaGrammar.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SchemaGrammar.java	9 Feb 2002 20:55:21 -0000	1.11
  +++ SchemaGrammar.java	18 Feb 2002 22:30:25 -0000	1.12
  @@ -60,6 +60,7 @@
   import org.apache.xerces.impl.dv.SchemaDVFactory;
   import org.apache.xerces.impl.dv.XSSimpleType;
   import org.apache.xerces.impl.xs.identity.IdentityConstraint;
  +import org.apache.xerces.impl.xs.util.SimpleLocator;
   import org.apache.xerces.util.SymbolTable;
   import org.apache.xerces.util.SymbolHash;
   
  @@ -80,7 +81,7 @@
    * @author Sandy Gao, IBM
    * @author Elena Litani, IBM
    *
  - * @version $Id: SchemaGrammar.java,v 1.11 2002/02/09 20:55:21 neilg Exp $
  + * @version $Id: SchemaGrammar.java,v 1.12 2002/02/18 22:30:25 sandygao Exp $
    */
   
   public class SchemaGrammar implements Grammar {
  @@ -117,7 +118,7 @@
        * 		at the least a systemId should always be known.
        */
       public SchemaGrammar(SymbolTable symbolTable, String targetNamespace,
  -    		XSDDescription grammarDesc) {
  +                XSDDescription grammarDesc) {
           fSymbolTable = symbolTable;
           fTargetNamespace = targetNamespace;
           fGrammarDescription = grammarDesc;
  @@ -148,8 +149,8 @@
       protected SchemaGrammar(SymbolTable symbolTable) {
           fSymbolTable = symbolTable;
           fTargetNamespace = SchemaSymbols.URI_SCHEMAFORSCHEMA;
  -	//REVISIT:  will we ever need non-null values in this XSDDescription object?
  -	fGrammarDescription = new XSDDescription();
  +        //REVISIT:  will we ever need non-null values in this XSDDescription object?
  +        fGrammarDescription = new XSDDescription();
   
           fGlobalAttrDecls  = new SymbolHash(1);
           fGlobalAttrGrpDecls = new SymbolHash(1);
  @@ -296,12 +297,14 @@
   
       private int fCTCount = 0;
       private XSComplexTypeDecl[] fComplexTypeDecls = new XSComplexTypeDecl[INITIAL_SIZE];
  +    private SimpleLocator[] fCTLocators = new SimpleLocator[INITIAL_SIZE];
   
       // an array to store groups being redefined by restriction
       // even-numbered elements are the derived groups, odd-numbered ones their bases
       private static final int REDEFINED_GROUP_INIT_SIZE = 2; 
       private int fRGCount = 0;
       private XSGroupDecl[] fRedefinedGroupDecls = new XSGroupDecl[REDEFINED_GROUP_INIT_SIZE];
  +    private SimpleLocator[] fRGLocators = new SimpleLocator[REDEFINED_GROUP_INIT_SIZE/2];
   
       // a flag to indicate whether we have checked the 3 constraints on this
       // grammar.
  @@ -310,19 +313,25 @@
       /**
        * add one complex type decl: for later constraint checking
        */
  -    public final void addComplexTypeDecl(XSComplexTypeDecl decl) {
  -        if (fCTCount == fComplexTypeDecls.length)
  +    public final void addComplexTypeDecl(XSComplexTypeDecl decl, SimpleLocator locator) {
  +        if (fCTCount == fComplexTypeDecls.length) {
               fComplexTypeDecls = resize(fComplexTypeDecls, fCTCount+INC_SIZE);
  +            fCTLocators = resize(fCTLocators, fCTCount+INC_SIZE);
  +        }
  +        fCTLocators[fCTCount] = locator;
           fComplexTypeDecls[fCTCount++] = decl;
       }
   
       /**
        * add a group redefined by restriction: for later constraint checking
        */
  -    public final void addRedefinedGroupDecl(XSGroupDecl derived, XSGroupDecl base) {
  -        if (fRGCount == fRedefinedGroupDecls.length)
  +    public final void addRedefinedGroupDecl(XSGroupDecl derived, XSGroupDecl base, SimpleLocator locator) {
  +        if (fRGCount == fRedefinedGroupDecls.length) {
               // double array size each time.
               fRedefinedGroupDecls = resize(fRedefinedGroupDecls, fRGCount << 1);
  +            fRGLocators = resize(fRGLocators, fRGCount);
  +        }
  +        fRGLocators[fCTCount/2] = locator;
           fRedefinedGroupDecls[fRGCount++] = derived;
           fRedefinedGroupDecls[fRGCount++] = base;
       }
  @@ -331,21 +340,46 @@
        * get all complex type decls: for later constraint checking
        */
       final XSComplexTypeDecl[] getUncheckedComplexTypeDecls() {
  -        if (fCTCount < fComplexTypeDecls.length)
  +        if (fCTCount < fComplexTypeDecls.length) {
               fComplexTypeDecls = resize(fComplexTypeDecls, fCTCount);
  +            fCTLocators = resize(fCTLocators, fCTCount);
  +        }
           return fComplexTypeDecls;
       }
   
       /**
  +     * get the error locator of all complex type decls
  +     */
  +    final SimpleLocator[] getUncheckedCTLocators() {
  +        if (fCTCount < fCTLocators.length) {
  +            fComplexTypeDecls = resize(fComplexTypeDecls, fCTCount);
  +            fCTLocators = resize(fCTLocators, fCTCount);
  +        }
  +        return fCTLocators;
  +    }
  +    
  +    /**
        * get all redefined groups: for later constraint checking
        */
       final XSGroupDecl[] getRedefinedGroupDecls() {
  -        if (fRGCount < fRedefinedGroupDecls.length)
  +        if (fRGCount < fRedefinedGroupDecls.length) {
               fRedefinedGroupDecls = resize(fRedefinedGroupDecls, fRGCount);
  +            fRGLocators = resize(fRGLocators, fRGCount/2);
  +        }
           return fRedefinedGroupDecls;
       }
   
  -
  +    /**
  +     * get the error locator of all redefined groups
  +     */
  +    final SimpleLocator[] getRGLocators() {
  +        if (fRGCount < fRedefinedGroupDecls.length) {
  +            fRedefinedGroupDecls = resize(fRedefinedGroupDecls, fRGCount);
  +            fRGLocators = resize(fRGLocators, fRGCount/2);
  +        }
  +        return fRGLocators;
  +    }
  +    
       /**
        * after the first-round checking, some types don't need to be checked
        * against UPA again. here we trim the array to the proper size.
  @@ -353,6 +387,7 @@
       final void setUncheckedTypeNum(int newSize) {
           fCTCount = newSize;
           fComplexTypeDecls = resize(fComplexTypeDecls, fCTCount);
  +        fCTLocators = resize(fCTLocators, fCTCount);
       }
   
       // used to store all substitution group information declared in
  @@ -408,6 +443,12 @@
   
       static final XSElementDecl[] resize(XSElementDecl[] oldArray, int newSize) {
           XSElementDecl[] newArray = new XSElementDecl[newSize];
  +        System.arraycopy(oldArray, 0, newArray, 0, Math.min(oldArray.length, newSize));
  +        return newArray;
  +    }
  +
  +    static final SimpleLocator[] resize(SimpleLocator[] oldArray, int newSize) {
  +        SimpleLocator[] newArray = new SimpleLocator[newSize];
           System.arraycopy(oldArray, 0, newArray, 0, Math.min(oldArray.length, newSize));
           return newArray;
       }
  
  
  
  1.17      +45 -35    xml-xerces/java/src/org/apache/xerces/impl/xs/XSConstraints.java
  
  Index: XSConstraints.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XSConstraints.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- XSConstraints.java	29 Jan 2002 01:15:14 -0000	1.16
  +++ XSConstraints.java	18 Feb 2002 22:30:25 -0000	1.17
  @@ -64,6 +64,7 @@
   import org.apache.xerces.impl.XMLErrorReporter;
   import org.apache.xerces.impl.xs.models.CMBuilder;
   import org.apache.xerces.impl.xs.models.XSCMValidator;
  +import org.apache.xerces.impl.xs.util.SimpleLocator;
   import org.apache.xerces.impl.validation.ValidationContext;
   import org.apache.xerces.util.SymbolHash;
   import java.util.Vector;
  @@ -73,7 +74,7 @@
    *
    * @author Sandy Gao, IBM
    *
  - * @version $Id: XSConstraints.java,v 1.16 2002/01/29 01:15:14 lehors Exp $
  + * @version $Id: XSConstraints.java,v 1.17 2002/02/18 22:30:25 sandygao Exp $
    */
   public class XSConstraints {
   
  @@ -301,6 +302,19 @@
           return actualValue;
       }
   
  +    static void reportSchemaError(XMLErrorReporter errorReporter,
  +                                  SimpleLocator loc,
  +                                  String key, Object[] args) {
  +        if (loc != null) {
  +            errorReporter.reportError(loc, XSMessageFormatter.SCHEMA_DOMAIN,
  +                                      key, args, XMLErrorReporter.SEVERITY_ERROR);
  +        }
  +        else {
  +            errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
  +                                      key, args, XMLErrorReporter.SEVERITY_ERROR);
  +        }
  +    }
  +
       /**
        * used to check the 3 constraints against each complex type
        * (should be each model group):
  @@ -322,6 +336,7 @@
           // groups redefined by restriction out of the way.
           for (int g = grammars.length-1; g >= 0; g--) {
               XSGroupDecl [] redefinedGroups = grammars[g].getRedefinedGroupDecls();
  +            SimpleLocator [] rgLocators = grammars[g].getRGLocators();
               for(int i=0; i<redefinedGroups.length; ) {
                   XSGroupDecl derivedGrp = redefinedGroups[i++];
                   XSParticleDecl derivedParticle = derivedGrp.fParticle;
  @@ -329,10 +344,9 @@
                   XSParticleDecl baseParticle = baseGrp.fParticle;
                   if(baseParticle == null) {
                       if(derivedParticle != null) { // can't be a restriction!
  -                        errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
  -                                        "src-redefine.6.2.2",
  -                                        new Object[]{derivedGrp.fName, "rcase-Recurse.2"},
  -                                        XMLErrorReporter.SEVERITY_ERROR);
  +                        reportSchemaError(errorReporter, rgLocators[i/2-1],
  +                                          "src-redefine.6.2.2",
  +                                          new Object[]{derivedGrp.fName, "rcase-Recurse.2"});
                       } 
                   } else {
                       try {
  @@ -340,14 +354,12 @@
                               derivedParticle, baseParticle);
                       } catch (XMLSchemaException e) {
                           String key = e.getKey();
  -                        errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
  -                                        key,
  -                                        e.getArgs(),
  -                                        XMLErrorReporter.SEVERITY_ERROR);
  -                        errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
  -                                        "src-redefine.6.2.2",
  -                                        new Object[]{derivedGrp.fName, key},
  -                                        XMLErrorReporter.SEVERITY_ERROR);
  +                        reportSchemaError(errorReporter, rgLocators[i/2-1],
  +                                          key,
  +                                          e.getArgs());
  +                        reportSchemaError(errorReporter, rgLocators[i/2-1],
  +                                          "src-redefine.6.2.2",
  +                                          new Object[]{derivedGrp.fName, key});
                       }
                   }
               }
  @@ -356,6 +368,7 @@
           // for each complex type, check the 3 constraints.
           // types need to be checked
           XSComplexTypeDecl[] types;
  +        SimpleLocator [] ctLocators;
           // to hold the errors
           // REVISIT: do we want to report all errors? or just one?
           //XMLSchemaError1D errors = new XMLSchemaError1D();
  @@ -368,13 +381,15 @@
           // for all grammars
           SymbolHash elemTable = new SymbolHash();
           for (int i = grammars.length-1, j, k; i >= 0; i--) {
  -            // get whether only check UPA, and types need to be checked
  +            // get whether to skip EDC, and types need to be checked
               keepType = 0;
               fullChecked = grammars[i].fFullChecked;
               types = grammars[i].getUncheckedComplexTypeDecls();
  +            ctLocators = grammars[i].getUncheckedCTLocators();
               // for each type
               for (j = types.length-1; j >= 0; j--) {
  -                // if only do UPA checking, skip the other two constraints
  +                // if we've already full-checked this grammar, then
  +                // skip the EDC constraint
                   if (!fullChecked) {
                   // 1. Element Decl Consistent
                     if (types[j].fParticle!=null) {
  @@ -384,10 +399,9 @@
                                                     elemTable, SGHandler);
                       }
                       catch (XMLSchemaException e) {
  -                      errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
  -                                                e.getKey(),
  -                                                e.getArgs(),
  -                                                XMLErrorReporter.SEVERITY_ERROR);
  +                      reportSchemaError(errorReporter, ctLocators[j],
  +                                        e.getKey(),
  +                                        e.getArgs());
                       }
                     }
                   }
  @@ -403,14 +417,12 @@
                         particleValidRestriction(SGHandler, types[j].fParticle,
                            ((XSComplexTypeDecl)(types[j].fBaseType)).fParticle);
                     } catch (XMLSchemaException e) {
  -                      errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
  -                                                e.getKey(),
  -                                                e.getArgs(),
  -                                                XMLErrorReporter.SEVERITY_ERROR);
  -                      errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
  -                                                "derivation-ok-restriction.5.3",
  -                                                new Object[]{types[j].fName},
  -                                                XMLErrorReporter.SEVERITY_ERROR);
  +                      reportSchemaError(errorReporter, ctLocators[j],
  +                                        e.getKey(),
  +                                        e.getArgs());
  +                      reportSchemaError(errorReporter, ctLocators[j],
  +                                        "derivation-ok-restriction.5.3",
  +                                        new Object[]{types[j].fName});
                     }
                   }
   
  @@ -422,19 +434,17 @@
                       try {
                           further = cm.checkUniqueParticleAttribution(SGHandler);
                       } catch (XMLSchemaException e) {
  -                        errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
  -                                                  e.getKey(),
  -                                                  e.getArgs(),
  -                                                  XMLErrorReporter.SEVERITY_ERROR);
  +                        reportSchemaError(errorReporter, ctLocators[j],
  +                                          e.getKey(),
  +                                          e.getArgs());
                       }
                   }
                   // now report all errors
                   // REVISIT: do we want to report all errors? or just one?
                   /*for (k = errors.getErrorCodeNum()-1; k >= 0; k--) {
  -                    errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
  -                                              errors.getErrorCode(k),
  -                                              errors.getArgs(k),
  -                                              XMLErrorReporter.SEVERITY_ERROR);
  +                    reportSchemaError(errorReporter, ctLocators[j],
  +                                      errors.getErrorCode(k),
  +                                      errors.getArgs(k));
                   }*/
   
                   // if we are doing all checkings, and this one needs further
  
  
  
  1.13      +3 -3      xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
  
  Index: XSDComplexTypeTraverser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- XSDComplexTypeTraverser.java	15 Feb 2002 22:08:48 -0000	1.12
  +++ XSDComplexTypeTraverser.java	18 Feb 2002 22:30:25 -0000	1.13
  @@ -91,7 +91,7 @@
    *            ((group | all | choice | sequence)?,
    *            ((attribute | attributeGroup)*, anyAttribute?))))
    * </complexType>
  - * @version $Id: XSDComplexTypeTraverser.java,v 1.12 2002/02/15 22:08:48 sandygao Exp $
  + * @version $Id: XSDComplexTypeTraverser.java,v 1.13 2002/02/18 22:30:25 sandygao Exp $
    */
   
   class  XSDComplexTypeTraverser extends XSDAbstractParticleTraverser {
  @@ -142,7 +142,7 @@
           XSComplexTypeDecl type = traverseComplexTypeDecl (complexTypeNode,
                                                             complexTypeName, attrValues, schemaDoc, grammar);
           // need to add the type to the grammar for later constraint checking
  -        grammar.addComplexTypeDecl(type);
  +        grammar.addComplexTypeDecl(type, fSchemaHandler.element2Locator(complexTypeNode));
           type.setIsAnonymous();
           fAttrChecker.returnAttrArray(attrValues, schemaDoc);
   
  @@ -172,7 +172,7 @@
               grammar.addGlobalTypeDecl(type);
           }
           // need to add the type to the grammar for later constraint checking
  -        grammar.addComplexTypeDecl(type);
  +        grammar.addComplexTypeDecl(type, fSchemaHandler.element2Locator(complexTypeNode));
           fAttrChecker.returnAttrArray(attrValues, schemaDoc);
   
           return type;
  
  
  
  1.8       +3 -2      xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDGroupTraverser.java
  
  Index: XSDGroupTraverser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDGroupTraverser.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XSDGroupTraverser.java	18 Feb 2002 20:57:25 -0000	1.7
  +++ XSDGroupTraverser.java	18 Feb 2002 22:30:25 -0000	1.8
  @@ -77,7 +77,7 @@
    * @author Rahul Srivastava, Sun Microsystems Inc.
    * @author Elena Litani, IBM
    * @author Lisa Martin,  IBM
  - * @version $Id: XSDGroupTraverser.java,v 1.7 2002/02/18 20:57:25 sandygao Exp $
  + * @version $Id: XSDGroupTraverser.java,v 1.8 2002/02/18 22:30:25 sandygao Exp $
    */
   class  XSDGroupTraverser extends XSDAbstractParticleTraverser {
   
  @@ -208,7 +208,8 @@
                   schemaDoc, elmNode);
               if(redefinedGrp != null) {
                   // store in grammar
  -                grammar.addRedefinedGroupDecl(group, (XSGroupDecl)redefinedGrp);
  +                grammar.addRedefinedGroupDecl(group, (XSGroupDecl)redefinedGrp,
  +                                              fSchemaHandler.element2Locator(elmNode));
               }
           }
   
  
  
  
  1.26      +36 -46    xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
  
  Index: XSDHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- XSDHandler.java	15 Feb 2002 22:08:48 -0000	1.25
  +++ XSDHandler.java	18 Feb 2002 22:30:25 -0000	1.26
  @@ -85,6 +85,7 @@
   
   import org.apache.xerces.impl.xs.dom.DOMParser;
   import org.apache.xerces.impl.xs.dom.ElementNSImpl;
  +import org.apache.xerces.impl.xs.util.SimpleLocator;
   import org.w3c.dom.Document;
   import org.w3c.dom.Attr;
   import org.w3c.dom.Element;
  @@ -112,9 +113,8 @@
    * schema, other grammars may be constructed as a side-effect.
    *
    * @author Neil Graham, IBM
  - * @version $Id: XSDHandler.java,v 1.25 2002/02/15 22:08:48 sandygao Exp $
  + * @version $Id: XSDHandler.java,v 1.26 2002/02/18 22:30:25 sandygao Exp $
    */
  -
   public class XSDHandler {
   
       // data
  @@ -1824,51 +1824,43 @@
           // if it's visible already than so must be its children
       } // setSchemasVisible(XSDocumentInfo): void
   
  -    // a locator used to convert a DOM element node to location information:
  -    // line/column number, system id, etc.
  -    private class MyLocator implements XMLLocator {
  -        int line, column;
  -        String pid, lsid, esid, bsid;
  -        
  -        void init(ElementNSImpl ele) {
  -            // line/column numbers are stored in the element node
  -            line = ele.getLineNumber();
  -            column = ele.getColumnNumber();
  -            // get system id from document object
  -            Document doc = ele.getOwnerDocument();
  -            lsid = esid = (String)fDoc2SystemId.get(doc);
  -        }
  -        
  -        public int getLineNumber() {
  -            return line;
  -        }
  -        
  -        public int getColumnNumber() {
  -            return column;
  -        }
  -
  -        public String getPublicId() {
  -            return pid;
  -        }
  +    private SimpleLocator xl = new SimpleLocator();
       
  -        public String getExpandedSystemId() {
  -            return esid;
  -        }
  -    
  -        public String getLiteralSystemId() {
  -            return lsid;
  -        }
  +    /**
  +     * Extract location information from an Element node, and create a
  +     * new SimpleLocator object from such information. Returning null means
  +     * no information can be retrieved from the element.
  +     */
  +    public SimpleLocator element2Locator(Element e) {
  +        if (!(e instanceof ElementNSImpl))
  +            return null;
  +        
  +        SimpleLocator l = new SimpleLocator();
  +        return element2Locator(e, l) ? l : null;
  +    }
       
  -        public String getBaseSystemId() {
  -            return bsid;
  -        }
  -    };
  -    private MyLocator xl = new MyLocator();
  +    /**
  +     * Extract location information from an Element node, store such
  +     * information in the passed-in SimpleLocator object, then return
  +     * true. Returning false means can't extract or store such information.
  +     */
  +    public boolean element2Locator(Element e, SimpleLocator l) {
  +        if (!(e instanceof ElementNSImpl) || l == null)
  +            return false;
  +            
  +        ElementNSImpl ele = (ElementNSImpl)e;
  +        // get system id from document object
  +        Document doc = ele.getOwnerDocument();
  +        String sid = (String)fDoc2SystemId.get(doc);
  +        // line/column numbers are stored in the element node
  +        int line = ele.getLineNumber();
  +        int column = ele.getColumnNumber();
  +        l.setValues(sid, sid, line, column);
  +        return true;
  +    }
       
       void reportSchemaError(String key, Object[] args, Element ele) {
  -        if (ele instanceof ElementNSImpl) {
  -            ElementNSImpl e = (ElementNSImpl)ele;
  -            xl.init(e);
  +        if (element2Locator(ele, xl)) {
               fErrorReporter.reportError(xl, XSMessageFormatter.SCHEMA_DOMAIN,
                                          key, args, XMLErrorReporter.SEVERITY_ERROR);
           }
  @@ -1879,9 +1871,7 @@
       }
   
       void reportSchemaWarning(String key, Object[] args, Element ele) {
  -        if (ele instanceof ElementNSImpl) {
  -            ElementNSImpl e = (ElementNSImpl)ele;
  -            xl.init(e);
  +        if (element2Locator(ele, xl)) {
               fErrorReporter.reportError(xl, XSMessageFormatter.SCHEMA_DOMAIN,
                                          key, args, XMLErrorReporter.SEVERITY_WARNING);
           }
  
  
  
  1.1                  xml-xerces/java/src/org/apache/xerces/impl/xs/util/SimpleLocator.java
  
  Index: SimpleLocator.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xerces" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 2001, International
   * Business Machines, Inc., http://www.apache.org.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.xerces.impl.xs.util;
  
  import org.apache.xerces.xni.XMLLocator;
  
  /**
   * An XMLLocator implementation used for schema error reporting.
   * 
   * @author Sandy Gao, IBM
   * @version $Id: SimpleLocator.java,v 1.1 2002/02/18 22:30:26 sandygao Exp $
   */
  public class SimpleLocator implements XMLLocator {
      String lsid, esid;
      int line, column;
      
      public SimpleLocator() {
      }
      
      public SimpleLocator(String lsid, String esid, int line, int column) {
          this.line = line;
          this.column = column;
          this.lsid = lsid;
          this.esid = esid;
      }
      
      public void setValues(String lsid, String esid, int line, int column) {
          this.line = line;
          this.column = column;
          this.lsid = lsid;
          this.esid = esid;
      }
      
      public int getLineNumber() {
          return line;
      }
      
      public int getColumnNumber() {
          return column;
      }
  
      public String getPublicId() {
          return null;
      }
  
      public String getExpandedSystemId() {
          return esid;
      }
  
      public String getLiteralSystemId() {
          return lsid;
      }
  
      public String getBaseSystemId() {
          return null;
      }
  }
  
  
  

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