1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package dom; 19 20 import org.w3c.dom.Document; 21 import org.w3c.dom.Text; 22 23 import org.xml.sax.SAXNotRecognizedException; 24 import org.xml.sax.SAXNotSupportedException; 25 26 /** 27 * Encapsulates a DOM parser. 28 * 29 * @version $Id: ParserWrapper.java 447683 2006-09-19 02:36:31Z mrglavas $ 30 */ 31 public interface ParserWrapper { 32 33 // 34 // ParserWrapper methods 35 // 36 37 /** Parses the specified URI and returns the document. */ 38 public Document parse(String uri) throws Exception; 39 40 /** 41 * Set the state of a feature. 42 * 43 * Set the state of any feature in a SAX2 parser. The parser 44 * might not recognize the feature, and if it does recognize 45 * it, it might not be able to fulfill the request. 46 * 47 * @param featureId The unique identifier (URI) of the feature. 48 * @param state The requested state of the feature (true or false). 49 * 50 * @exception org.xml.sax.SAXNotRecognizedException If the 51 * requested feature is not known. 52 * @exception org.xml.sax.SAXNotSupportedException If the 53 * requested feature is known, but the requested 54 * state is not supported. 55 * @exception org.xml.sax.SAXException If there is any other 56 * problem fulfilling the request. 57 */ 58 public void setFeature(String featureId, boolean state) 59 throws SAXNotRecognizedException, SAXNotSupportedException; 60 61 /** Returns the document information. */ 62 public DocumentInfo getDocumentInfo(); 63 64 // 65 // Interfaces 66 // 67 68 /** 69 * This interface is here to query information about the document 70 * implementation returned by the <code>ParserWrapper#parse</code> 71 * method. 72 * 73 * @author Andy Clark, IBM 74 */ 75 public interface DocumentInfo { 76 77 // 78 // DocumentInfo methods 79 // 80 81 /** 82 * Returns true if the specified text node is ignorable whitespace. 83 */ 84 public boolean isIgnorableWhitespace(Text text); 85 86 } // interface DocumentInfo 87 88 } // interface ParserWrapper