001 /* 002 * Copyright 2010-2013 JetBrains s.r.o. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 package org.jetbrains.jet.cli.common.modules; 018 019 import org.jetbrains.annotations.NotNull; 020 import org.xml.sax.*; 021 import org.xml.sax.helpers.DefaultHandler; 022 023 import java.io.IOException; 024 025 public abstract class DelegatedSaxHandler extends DefaultHandler { 026 027 @NotNull 028 protected abstract DefaultHandler getDelegate(); 029 030 @Override 031 public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { 032 return getDelegate().resolveEntity(publicId, systemId); 033 } 034 035 @Override 036 public void notationDecl(String name, String publicId, String systemId) throws SAXException { 037 getDelegate().notationDecl(name, publicId, systemId); 038 } 039 040 @Override 041 public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException { 042 getDelegate().unparsedEntityDecl(name, publicId, systemId, notationName); 043 } 044 045 @Override 046 public void setDocumentLocator(Locator locator) { 047 getDelegate().setDocumentLocator(locator); 048 } 049 050 @Override 051 public void startDocument() throws SAXException { 052 getDelegate().startDocument(); 053 } 054 055 @Override 056 public void endDocument() throws SAXException { 057 getDelegate().endDocument(); 058 } 059 060 @Override 061 public void startPrefixMapping(String prefix, String uri) throws SAXException { 062 getDelegate().startPrefixMapping(prefix, uri); 063 } 064 065 @Override 066 public void endPrefixMapping(String prefix) throws SAXException { 067 getDelegate().endPrefixMapping(prefix); 068 } 069 070 @Override 071 public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { 072 getDelegate().startElement(uri, localName, qName, attributes); 073 } 074 075 @Override 076 public void endElement(String uri, String localName, String qName) throws SAXException { 077 getDelegate().endElement(uri, localName, qName); 078 } 079 080 @Override 081 public void characters(char[] ch, int start, int length) throws SAXException { 082 getDelegate().characters(ch, start, length); 083 } 084 085 @Override 086 public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { 087 getDelegate().ignorableWhitespace(ch, start, length); 088 } 089 090 @Override 091 public void processingInstruction(String target, String data) throws SAXException { 092 getDelegate().processingInstruction(target, data); 093 } 094 095 @Override 096 public void skippedEntity(String name) throws SAXException { 097 getDelegate().skippedEntity(name); 098 } 099 100 @Override 101 public void warning(SAXParseException e) throws SAXException { 102 getDelegate().warning(e); 103 } 104 105 @Override 106 public void error(SAXParseException e) throws SAXException { 107 getDelegate().error(e); 108 } 109 110 @Override 111 public void fatalError(SAXParseException e) throws SAXException { 112 getDelegate().fatalError(e); 113 } 114 }