You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@apache.org on 2001/04/10 06:49:32 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/parsers AbstractSAXParser.java StandardParserConfiguration.java

andyc       01/04/09 21:49:31

  Modified:    java/src/org/apache/xerces/parsers Tag: xerces_j_2
                        AbstractSAXParser.java
                        StandardParserConfiguration.java
  Log:
  Locator object not passed to SAX1 DocumentHandler/SAX2
  ContentHandler. This problem was actually in two parts:
  
  1) The standard parser configuration was not setting
     this property -- therefore no component (including
     the parser could query the locator.
  
  2) The SAX parser was not retrieving the locator in order
     to pass it on the handlers.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.10  +16 -1     xml-xerces/java/src/org/apache/xerces/parsers/Attic/AbstractSAXParser.java
  
  Index: AbstractSAXParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/AbstractSAXParser.java,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- AbstractSAXParser.java	2001/04/08 17:53:56	1.1.2.9
  +++ AbstractSAXParser.java	2001/04/10 04:49:31	1.1.2.10
  @@ -90,7 +90,7 @@
    * @author Arnaud Le Hors, IBM
    * @author Andy Clark, IBM
    *
  - * @version $Id: AbstractSAXParser.java,v 1.1.2.9 2001/04/08 17:53:56 lehors Exp $ 
  + * @version $Id: AbstractSAXParser.java,v 1.1.2.10 2001/04/10 04:49:31 andyc Exp $ 
    */
   public abstract class AbstractSAXParser
       extends AbstractXMLDocumentParser
  @@ -194,13 +194,28 @@
       public void startDocument(String systemId, String encoding) 
           throws SAXException {
   
  +        // get the locator
  +        Locator locator = null;
  +        try {
  +            locator = (Locator)fConfiguration.getProperty(LOCATOR);
  +        }
  +        catch (SAXException e) {
  +            // ignore
  +        }
  +
           // SAX1
           if (fDocumentHandler != null) {
  +            if (locator != null) {
  +                fDocumentHandler.setDocumentLocator(locator);
  +            }
               fDocumentHandler.startDocument();
           }
   
           // SAX2
           if (fContentHandler != null) {
  +            if (locator != null) {
  +                fContentHandler.setDocumentLocator(locator);
  +            }
               fContentHandler.startDocument();
           }
   
  
  
  
  1.1.2.7   +9 -3      xml-xerces/java/src/org/apache/xerces/parsers/Attic/StandardParserConfiguration.java
  
  Index: StandardParserConfiguration.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/StandardParserConfiguration.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- StandardParserConfiguration.java	2001/04/07 02:38:52	1.1.2.6
  +++ StandardParserConfiguration.java	2001/04/10 04:49:31	1.1.2.7
  @@ -111,7 +111,7 @@
    * @author Arnaud  Le Hors, IBM
    * @author Andy Clark, IBM
    *
  - * @version $Id: StandardParserConfiguration.java,v 1.1.2.6 2001/04/07 02:38:52 lehors Exp $
  + * @version $Id: StandardParserConfiguration.java,v 1.1.2.7 2001/04/10 04:49:31 andyc Exp $
    */
   public class StandardParserConfiguration
       extends BasicParserConfiguration {
  @@ -152,6 +152,10 @@
       protected static final String ENTITY_MANAGER = 
           Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
       
  +    /** Property identifier: locator. */
  +    protected static final String LOCATOR = 
  +        Constants.XERCES_PROPERTY_PREFIX + Constants.LOCATOR_PROPERTY;
  +    
       /** Property identifier document scanner: */
       protected static final String DOCUMENT_SCANNER = 
           Constants.XERCES_PROPERTY_PREFIX + Constants.DOCUMENT_SCANNER_PROPERTY;
  @@ -262,8 +266,9 @@
   
           // add default recognized properties
           final String[] recognizedProperties = {
  -            ERROR_REPORTER, ENTITY_MANAGER, 
  -            GRAMMAR_POOL,   DATATYPE_VALIDATOR_FACTORY
  +            ERROR_REPORTER,             ENTITY_MANAGER, 
  +            LOCATOR,                    GRAMMAR_POOL,   
  +            DATATYPE_VALIDATOR_FACTORY,
           };
           addRecognizedProperties(recognizedProperties);
   
  @@ -284,6 +289,7 @@
               fProperties.put(ENTITY_MANAGER, fEntityManager);
               addComponent(fEntityManager);
               fLocator = (Locator)fEntityManager.getEntityScanner();
  +            fProperties.put(LOCATOR, fLocator);
           }
   
           if (fErrorReporter == null) {
  
  
  

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