You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2005/06/24 19:56:41 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl/xs/traversers XSDHandler.java

mrglavas    2005/06/24 10:56:41

  Modified:    java/src/org/apache/xerces/impl XMLErrorReporter.java
               java/src/org/apache/xerces/impl/xs/traversers
                        XSDHandler.java
  Log:
  Fixing a bug. When a SAXSource has been specified as
  an input to the schema loader we weren't setting an
  error handler on the XMLReader.
  
  Revision  Changes    Path
  1.16      +21 -1     xml-xerces/java/src/org/apache/xerces/impl/XMLErrorReporter.java
  
  Index: XMLErrorReporter.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLErrorReporter.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- XMLErrorReporter.java	4 Oct 2004 21:45:48 -0000	1.15
  +++ XMLErrorReporter.java	24 Jun 2005 17:56:41 -0000	1.16
  @@ -20,6 +20,7 @@
   import java.util.Locale;
   
   import org.apache.xerces.util.DefaultErrorHandler;
  +import org.apache.xerces.util.ErrorHandlerProxy;
   import org.apache.xerces.util.MessageFormatter;
   import org.apache.xerces.xni.XMLLocator;
   import org.apache.xerces.xni.XNIException;
  @@ -28,6 +29,7 @@
   import org.apache.xerces.xni.parser.XMLConfigurationException;
   import org.apache.xerces.xni.parser.XMLErrorHandler;
   import org.apache.xerces.xni.parser.XMLParseException;
  +import org.xml.sax.ErrorHandler;
   
   /**
    * This class is a common element of all parser configurations and is
  @@ -161,6 +163,9 @@
        * reported by users of the parser.
        */
       protected XMLErrorHandler fDefaultErrorHandler;
  +    
  +    /** A SAX proxy to the error handler contained in this error reporter. */
  +    private ErrorHandler fSaxProxy = null;
   
       //
       // Constructors
  @@ -543,4 +548,19 @@
           return fErrorHandler;
       }
       
  +    /**
  +     * Gets the internal XMLErrorHandler
  +     * as SAX ErrorHandler.
  +     */
  +    public ErrorHandler getSAXErrorHandler() {
  +        if (fSaxProxy == null) {
  +            fSaxProxy = new ErrorHandlerProxy() {
  +                protected XMLErrorHandler getErrorHandler() {
  +                    return fErrorHandler;
  +                }
  +            };
  +        }
  +        return fSaxProxy;
  +    }
  +    
   } // class XMLErrorReporter
  
  
  
  1.92      +5 -3      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.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- XSDHandler.java	30 May 2005 04:17:12 -0000	1.91
  +++ XSDHandler.java	24 Jun 2005 17:56:41 -0000	1.92
  @@ -501,7 +501,8 @@
               }
               fXSContentHandler.reset(fSchemaParser, fSymbolTable, 
                       namespacePrefixes, stringsInternalized);
  -        	parser.setContentHandler(fXSContentHandler);   
  +            parser.setContentHandler(fXSContentHandler);
  +            parser.setErrorHandler(fErrorReporter.getSAXErrorHandler());
           	try {
               	parser.parse(inputSource);	
           	}
  @@ -1724,7 +1725,8 @@
               }
               fXSContentHandler.reset(fSchemaParser, fSymbolTable, 
                       namespacePrefixes, stringsInternalized);
  -            parser.setContentHandler(fXSContentHandler);   
  +            parser.setContentHandler(fXSContentHandler);
  +            parser.setErrorHandler(fErrorReporter.getSAXErrorHandler());
               try {
                   parser.parse(inputSource);  
               }
  
  
  

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