xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@locus.apache.org
Subject cvs commit: xml-stylebook/src/org/apache/stylebook/parsers XML4JParser.java XercesParser.java
Date Wed, 01 Dec 1999 02:04:53 GMT
pier        99/11/30 18:04:52

  Modified:    src/org/apache/stylebook build.bat
               src/org/apache/stylebook/parsers XML4JParser.java
                        XercesParser.java
  Log:
  Added ErrorHandler to Xalan and XML4J parsers.
  
  Revision  Changes    Path
  1.2       +1 -1      xml-stylebook/src/org/apache/stylebook/build.bat
  
  Index: build.bat
  ===================================================================
  RCS file: /home/cvs/xml-stylebook/src/org/apache/stylebook/build.bat,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- build.bat	1999/11/30 12:29:25	1.1
  +++ build.bat	1999/12/01 02:04:52	1.2
  @@ -1,2 +1,2 @@
   @echo off
  -javac *.java parsers\*.java printers\*.java processors\*.java producers\*.java 
  +javac -d \java\classes *.java parsers\*.java printers\*.java processors\*.java producers\*.java

  
  
  
  1.3       +45 -2     xml-stylebook/src/org/apache/stylebook/parsers/XML4JParser.java
  
  Index: XML4JParser.java
  ===================================================================
  RCS file: /home/cvs/xml-stylebook/src/org/apache/stylebook/parsers/XML4JParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XML4JParser.java	1999/11/30 12:28:53	1.2
  +++ XML4JParser.java	1999/12/01 02:04:52	1.3
  @@ -13,8 +13,10 @@
   import org.apache.stylebook.CreationException;
   import com.ibm.xml.dom.DocumentImpl;
   import com.ibm.xml.parsers.DOMParser;
  +import org.xml.sax.ErrorHandler;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
  +import org.xml.sax.SAXParseException;
   import org.w3c.dom.Document;
   
   /**
  @@ -23,9 +25,9 @@
    * @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
    * @author Copyright 1999 &copy; <a href="http://www.apache.org">The Apache
    *         Software Foundation</a>. All rights reserved.
  - * @version CVS $Revision: 1.2 $ $Date: 1999/11/30 12:28:53 $
  + * @version CVS $Revision: 1.3 $ $Date: 1999/12/01 02:04:52 $
    */
  -public class XML4JParser extends AbstractParser implements Parser {
  +public class XML4JParser extends AbstractParser implements Parser,ErrorHandler {
       /**
        * Parse the specified InputSource.
        *
  @@ -40,6 +42,7 @@
           this.debug("Parsing \""+in.getSystemId()+"\"");
           try {
               DOMParser parser=new DOMParser();
  +            parser.setErrorHandler(this);
               parser.parse(in);
               Document document=parser.getDocument();
               if (document==null) {
  @@ -62,5 +65,45 @@
       public Document create() {
           this.debug("Creating new Document");
           return new DocumentImpl();
  +    }
  +
  +    /**
  +     * Receive notification of a recoverable error.
  +     *
  +     * @param e The Exception thrown during parsing.
  +     * @exception SAXException The Exception notifying the client.
  +     */
  +    public void error(SAXParseException e)
  +    throws SAXException {
  +        throw new SAXException(e.getMessage()+" [File: \""+e.getSystemId()+
  +                               "\" Line: "+e.getLineNumber()+" Column: "+
  +                               e.getColumnNumber()+"]",e);
  +    }
  +
  +
  +    /**
  +     * Receive notification of a non-recoverable error.
  +     *
  +     * @param e The Exception thrown during parsing.
  +     * @exception SAXException The Exception notifying the client.
  +     */
  +    public void fatalError(SAXParseException e)
  +    throws SAXException {
  +        throw new SAXException(e.getMessage()+" [File: \""+e.getSystemId()+
  +                               "\" Line: "+e.getLineNumber()+" Column: "+
  +                               e.getColumnNumber()+"]",e);
  +    }
  +
  +    /**
  +     * Receive notification of a warning.
  +     *
  +     * @param e The Exception thrown during parsing.
  +     * @exception SAXException The Exception notifying the client.
  +     */
  +    public void warning(SAXParseException e)
  +    throws SAXException {
  +        throw new SAXException(e.getMessage()+" [File: \""+e.getSystemId()+
  +                               "\" Line: "+e.getLineNumber()+" Column: "+
  +                               e.getColumnNumber()+"]",e);
       }
   }
  
  
  
  1.6       +44 -2     xml-stylebook/src/org/apache/stylebook/parsers/XercesParser.java
  
  Index: XercesParser.java
  ===================================================================
  RCS file: /home/cvs/xml-stylebook/src/org/apache/stylebook/parsers/XercesParser.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XercesParser.java	1999/11/30 12:28:53	1.5
  +++ XercesParser.java	1999/12/01 02:04:52	1.6
  @@ -13,8 +13,10 @@
   import org.apache.stylebook.CreationException;
   import org.apache.xerces.dom.DocumentImpl;
   import org.apache.xerces.parsers.DOMParser;
  +import org.xml.sax.ErrorHandler;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
  +import org.xml.sax.SAXParseException;
   import org.w3c.dom.Document;
   
   /**
  @@ -23,9 +25,9 @@
    * @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
    * @author Copyright 1999 &copy; <a href="http://www.apache.org">The Apache
    *         Software Foundation</a>. All rights reserved.
  - * @version CVS $Revision: 1.5 $ $Date: 1999/11/30 12:28:53 $
  + * @version CVS $Revision: 1.6 $ $Date: 1999/12/01 02:04:52 $
    */
  -public class XercesParser extends AbstractParser implements Parser {
  +public class XercesParser extends AbstractParser implements Parser,ErrorHandler {
       /**
        * Parse the specified InputSource.
        *
  @@ -42,6 +44,7 @@
               DOMParser p=new DOMParser();
               p.setFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes",false);
               p.setFeature("http://apache.org/xml/features/validation/dynamic",true);
  +            p.setErrorHandler(this);
               p.parse(in);
               Document document=p.getDocument();
               if (document==null) {
  @@ -62,5 +65,44 @@
       public Document create() {
           this.debug("Creating new Document");
           return new DocumentImpl();
  +    }
  +
  +    /**
  +     * Receive notification of a recoverable error.
  +     *
  +     * @param e The Exception thrown during parsing.
  +     * @exception SAXException The Exception notifying the client.
  +     */
  +    public void error(SAXParseException e)
  +    throws SAXException {
  +        throw new SAXException(e.getMessage()+" [File: \""+e.getSystemId()+
  +                               "\" Line: "+e.getLineNumber()+" Column: "+
  +                               e.getColumnNumber()+"]",e);
  +    }
  +
  +    /**
  +     * Receive notification of a non-recoverable error.
  +     *
  +     * @param e The Exception thrown during parsing.
  +     * @exception SAXException The Exception notifying the client.
  +     */
  +    public void fatalError(SAXParseException e)
  +    throws SAXException {
  +        throw new SAXException(e.getMessage()+" [File: \""+e.getSystemId()+
  +                               "\" Line: "+e.getLineNumber()+" Column: "+
  +                               e.getColumnNumber()+"]",e);
  +    }
  +
  +    /**
  +     * Receive notification of a warning.
  +     *
  +     * @param e The Exception thrown during parsing.
  +     * @exception SAXException The Exception notifying the client.
  +     */
  +    public void warning(SAXParseException e)
  +    throws SAXException {
  +        throw new SAXException(e.getMessage()+" [File: \""+e.getSystemId()+
  +                               "\" Line: "+e.getLineNumber()+" Column: "+
  +                               e.getColumnNumber()+"]",e);
       }
   }
  
  
  

Mime
View raw message