KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > dom > ParserWrapper


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package dom;
18
19 import org.w3c.dom.Document JavaDoc;
20 import org.w3c.dom.Text JavaDoc;
21
22 import org.xml.sax.SAXNotRecognizedException JavaDoc;
23 import org.xml.sax.SAXNotSupportedException JavaDoc;
24
25 /**
26  * Encapsulates a DOM parser.
27  *
28  * @version $Id: ParserWrapper.java,v 1.4 2004/02/24 23:41:05 mrglavas Exp $
29  */

30 public interface ParserWrapper {
31
32     //
33
// ParserWrapper methods
34
//
35

36     /** Parses the specified URI and returns the document. */
37     public Document JavaDoc parse(String JavaDoc uri) throws Exception JavaDoc;
38
39     /**
40      * Set the state of a feature.
41      *
42      * Set the state of any feature in a SAX2 parser. The parser
43      * might not recognize the feature, and if it does recognize
44      * it, it might not be able to fulfill the request.
45      *
46      * @param featureId The unique identifier (URI) of the feature.
47      * @param state The requested state of the feature (true or false).
48      *
49      * @exception org.xml.sax.SAXNotRecognizedException If the
50      * requested feature is not known.
51      * @exception org.xml.sax.SAXNotSupportedException If the
52      * requested feature is known, but the requested
53      * state is not supported.
54      * @exception org.xml.sax.SAXException If there is any other
55      * problem fulfilling the request.
56      */

57     public void setFeature(String JavaDoc featureId, boolean state)
58         throws SAXNotRecognizedException JavaDoc, SAXNotSupportedException JavaDoc;
59
60     /** Returns the document information. */
61     public DocumentInfo getDocumentInfo();
62
63     //
64
// Interfaces
65
//
66

67     /**
68      * This interface is here to query information about the document
69      * implementation returned by the <code>ParserWrapper#parse</code>
70      * method.
71      *
72      * @author Andy Clark, IBM
73      */

74     public interface DocumentInfo {
75
76         //
77
// DocumentInfo methods
78
//
79

80         /**
81          * Returns true if the specified text node is ignorable whitespace.
82          */

83         public boolean isIgnorableWhitespace(Text JavaDoc text);
84
85     } // interface DocumentInfo
86

87 } // interface ParserWrapper
88
Popular Tags