home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / xml-apis.jar / javax / xml / parsers / SAXParser.class (.txt) < prev    next >
Encoding:
Java Class File  |  2003-11-18  |  2.9 KB  |  141 lines

  1. package javax.xml.parsers;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5. import java.io.InputStream;
  6. import org.xml.sax.HandlerBase;
  7. import org.xml.sax.InputSource;
  8. import org.xml.sax.Parser;
  9. import org.xml.sax.SAXException;
  10. import org.xml.sax.SAXNotRecognizedException;
  11. import org.xml.sax.SAXNotSupportedException;
  12. import org.xml.sax.XMLReader;
  13. import org.xml.sax.helpers.DefaultHandler;
  14.  
  15. public abstract class SAXParser {
  16.    private static final boolean DEBUG = false;
  17.  
  18.    protected SAXParser() {
  19.    }
  20.  
  21.    public void parse(InputStream var1, HandlerBase var2) throws SAXException, IOException {
  22.       if (var1 == null) {
  23.          throw new IllegalArgumentException("InputStream cannot be null");
  24.       } else {
  25.          InputSource var3 = new InputSource(var1);
  26.          this.parse(var3, var2);
  27.       }
  28.    }
  29.  
  30.    public void parse(InputStream var1, HandlerBase var2, String var3) throws SAXException, IOException {
  31.       if (var1 == null) {
  32.          throw new IllegalArgumentException("InputStream cannot be null");
  33.       } else {
  34.          InputSource var4 = new InputSource(var1);
  35.          var4.setSystemId(var3);
  36.          this.parse(var4, var2);
  37.       }
  38.    }
  39.  
  40.    public void parse(InputStream var1, DefaultHandler var2) throws SAXException, IOException {
  41.       if (var1 == null) {
  42.          throw new IllegalArgumentException("InputStream cannot be null");
  43.       } else {
  44.          InputSource var3 = new InputSource(var1);
  45.          this.parse(var3, var2);
  46.       }
  47.    }
  48.  
  49.    public void parse(InputStream var1, DefaultHandler var2, String var3) throws SAXException, IOException {
  50.       if (var1 == null) {
  51.          throw new IllegalArgumentException("InputStream cannot be null");
  52.       } else {
  53.          InputSource var4 = new InputSource(var1);
  54.          var4.setSystemId(var3);
  55.          this.parse(var4, var2);
  56.       }
  57.    }
  58.  
  59.    public void parse(String var1, HandlerBase var2) throws SAXException, IOException {
  60.       if (var1 == null) {
  61.          throw new IllegalArgumentException("uri cannot be null");
  62.       } else {
  63.          InputSource var3 = new InputSource(var1);
  64.          this.parse(var3, var2);
  65.       }
  66.    }
  67.  
  68.    public void parse(String var1, DefaultHandler var2) throws SAXException, IOException {
  69.       if (var1 == null) {
  70.          throw new IllegalArgumentException("uri cannot be null");
  71.       } else {
  72.          InputSource var3 = new InputSource(var1);
  73.          this.parse(var3, var2);
  74.       }
  75.    }
  76.  
  77.    public void parse(File var1, HandlerBase var2) throws SAXException, IOException {
  78.       if (var1 == null) {
  79.          throw new IllegalArgumentException("File cannot be null");
  80.       } else {
  81.          String var3 = FilePathToURI.filepath2URI(var1.getAbsolutePath());
  82.          InputSource var4 = new InputSource(var3);
  83.          this.parse(var4, var2);
  84.       }
  85.    }
  86.  
  87.    public void parse(File var1, DefaultHandler var2) throws SAXException, IOException {
  88.       if (var1 == null) {
  89.          throw new IllegalArgumentException("File cannot be null");
  90.       } else {
  91.          String var3 = FilePathToURI.filepath2URI(var1.getAbsolutePath());
  92.          InputSource var4 = new InputSource(var3);
  93.          this.parse(var4, var2);
  94.       }
  95.    }
  96.  
  97.    public void parse(InputSource var1, HandlerBase var2) throws SAXException, IOException {
  98.       if (var1 == null) {
  99.          throw new IllegalArgumentException("InputSource cannot be null");
  100.       } else {
  101.          Parser var3 = this.getParser();
  102.          if (var2 != null) {
  103.             var3.setDocumentHandler(var2);
  104.             var3.setEntityResolver(var2);
  105.             var3.setErrorHandler(var2);
  106.             var3.setDTDHandler(var2);
  107.          }
  108.  
  109.          var3.parse(var1);
  110.       }
  111.    }
  112.  
  113.    public void parse(InputSource var1, DefaultHandler var2) throws SAXException, IOException {
  114.       if (var1 == null) {
  115.          throw new IllegalArgumentException("InputSource cannot be null");
  116.       } else {
  117.          XMLReader var3 = this.getXMLReader();
  118.          if (var2 != null) {
  119.             var3.setContentHandler(var2);
  120.             var3.setEntityResolver(var2);
  121.             var3.setErrorHandler(var2);
  122.             var3.setDTDHandler(var2);
  123.          }
  124.  
  125.          var3.parse(var1);
  126.       }
  127.    }
  128.  
  129.    public abstract Parser getParser() throws SAXException;
  130.  
  131.    public abstract XMLReader getXMLReader() throws SAXException;
  132.  
  133.    public abstract boolean isNamespaceAware();
  134.  
  135.    public abstract boolean isValidating();
  136.  
  137.    public abstract void setProperty(String var1, Object var2) throws SAXNotRecognizedException, SAXNotSupportedException;
  138.  
  139.    public abstract Object getProperty(String var1) throws SAXNotRecognizedException, SAXNotSupportedException;
  140. }
  141.