1 /* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5 /* 6 * The Apache Software License, Version 1.1 7 * 8 * 9 * Copyright (c) 2000-2002 The Apache Software Foundation. All rights 10 * reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 16 * 1. Redistributions of source code must retain the above copyright 17 * notice, this list of conditions and the following disclaimer. 18 * 19 * 2. Redistributions in binary form must reproduce the above copyright 20 * notice, this list of conditions and the following disclaimer in 21 * the documentation and/or other materials provided with the 22 * distribution. 23 * 24 * 3. The end-user documentation included with the redistribution, 25 * if any, must include the following acknowledgment: 26 * "This product includes software developed by the 27 * Apache Software Foundation (http://www.apache.org/)." 28 * Alternately, this acknowledgment may appear in the software itself, 29 * if and wherever such third-party acknowledgments normally appear. 30 * 31 * 4. The names "Xerces" and "Apache Software Foundation" must 32 * not be used to endorse or promote products derived from this 33 * software without prior written permission. For written 34 * permission, please contact apache@apache.org. 35 * 36 * 5. Products derived from this software may not be called "Apache", 37 * nor may "Apache" appear in their name, without prior written 38 * permission of the Apache Software Foundation. 39 * 40 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 41 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 42 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 43 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 44 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 46 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 47 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 48 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 49 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 50 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 * SUCH DAMAGE. 52 * ==================================================================== 53 * 54 * This software consists of voluntary contributions made by many 55 * individuals on behalf of the Apache Software Foundation and was 56 * originally based on software copyright (c) 1999, International 57 * Business Machines, Inc., http://www.apache.org. For more 58 * information on the Apache Software Foundation, please see 59 * <http://www.apache.org/>. 60 */ 61 package com.sun.org.apache.xerces.internal.util; 62 63 import com.sun.org.apache.xerces.internal.xni.Augmentations; 64 import com.sun.org.apache.xerces.internal.xni.NamespaceContext; 65 import com.sun.org.apache.xerces.internal.xni.QName; 66 import com.sun.org.apache.xerces.internal.xni.XMLAttributes; 67 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler; 68 import com.sun.org.apache.xerces.internal.xni.XMLLocator; 69 import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; 70 import com.sun.org.apache.xerces.internal.xni.XMLString; 71 import com.sun.org.apache.xerces.internal.xni.XNIException; 72 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentFilter; 73 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource; 74 75 /** 76 * Default implementation of {@link XMLDocumentFilter} 77 * that simply passes through events to the next component. 78 * 79 * <p> 80 * Can be used as a base implementation of other more sophisticated 81 * {@link XMLDocumentFilter}s. 82 * 83 * @author 84 * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) 85 */ 86 public class XMLDocumentFilterImpl implements XMLDocumentFilter { 87 private XMLDocumentHandler next; 88 private XMLDocumentSource source; 89 90 91 public void setDocumentHandler(XMLDocumentHandler handler) { 92 this.next = handler; 93 } 94 95 public XMLDocumentHandler getDocumentHandler() { 96 return next; 97 } 98 99 public void setDocumentSource(XMLDocumentSource source) { 100 this.source = source; 101 } 102 103 public XMLDocumentSource getDocumentSource() { 104 return source; 105 } 106 107 108 109 110 111 112 public void characters(XMLString text, Augmentations augs) throws XNIException { 113 next.characters(text, augs); 114 } 115 116 public void comment(XMLString text, Augmentations augs) throws XNIException { 117 next.comment(text, augs); 118 } 119 120 public void doctypeDecl(String rootElement, String publicId, String systemId, Augmentations augs) 121 throws XNIException { 122 next.doctypeDecl(rootElement, publicId, systemId, augs); 123 } 124 125 public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { 126 next.emptyElement(element, attributes, augs); 127 } 128 129 public void endCDATA(Augmentations augs) throws XNIException { 130 next.endCDATA(augs); 131 } 132 133 public void endDocument(Augmentations augs) throws XNIException { 134 next.endDocument(augs); 135 } 136 137 public void endElement(QName element, Augmentations augs) throws XNIException { 138 next.endElement(element, augs); 139 } 140 141 public void endGeneralEntity(String name, Augmentations augs) throws XNIException { 142 next.endGeneralEntity(name, augs); 143 } 144 145 public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException { 146 next.ignorableWhitespace(text, augs); 147 } 148 149 public void processingInstruction(String target, XMLString data, Augmentations augs) throws XNIException { 150 next.processingInstruction(target, data, augs); 151 } 152 153 public void startCDATA(Augmentations augs) throws XNIException { 154 next.startCDATA(augs); 155 } 156 157 public void startDocument( 158 XMLLocator locator, 159 String encoding, 160 NamespaceContext namespaceContext, 161 Augmentations augs) 162 throws XNIException { 163 next.startDocument(locator, encoding, namespaceContext, augs); 164 } 165 166 public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { 167 next.startElement(element, attributes, augs); 168 } 169 170 public void startGeneralEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) 171 throws XNIException { 172 next.startGeneralEntity(name, identifier, encoding, augs); 173 } 174 175 public void textDecl(String version, String encoding, Augmentations augs) throws XNIException { 176 next.textDecl(version, encoding, augs); 177 } 178 179 public void xmlDecl(String version, String encoding, String standalone, Augmentations augs) throws XNIException { 180 next.xmlDecl(version, encoding, standalone, augs); 181 } 182 }