KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > syndication > io > WireFeedParser


1 /*
2  * Copyright 2004 Sun Microsystems, Inc.
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 com.sun.syndication.io;
18
19 import com.sun.syndication.feed.WireFeed;
20 import com.sun.syndication.io.FeedException;
21 import org.jdom.Document;
22
23 /**
24  * Parses an XML document (JDOM) into a feed bean.
25  * <p>
26  * WireFeedParser instances must thread safe.
27  * <p>
28  * TODO: explain how developers can plugin their own implementations.
29  * <p>
30  * @author Alejandro Abdelnur
31  *
32  */

33 public interface WireFeedParser {
34
35     /**
36      * Returns the type of feed the parser handles.
37      * <p>
38      * @see WireFeed for details on the format of this string.
39      * <p>
40      * @return the type of feed the parser handles.
41      *
42      */

43     public String JavaDoc getType();
44
45     /**
46      * Inspects an XML Document (JDOM) to check if it can parse it.
47      * <p>
48      * It checks if the given document if the type of feeds the parser understands.
49      * <p>
50      * @param document XML Document (JDOM) to check if it can be parsed by this parser.
51      * @return <b>true</b> if the parser know how to parser this feed, <b>false</b> otherwise.
52      *
53      */

54     public boolean isMyType(Document document);
55
56     /**
57      * Parses an XML document (JDOM Document) into a feed bean.
58      * <p>
59      * @param document XML document (JDOM) to parse.
60      * @param validate indicates if the feed should be strictly validated (NOT YET IMPLEMENTED).
61      * @return the resulting feed bean.
62      * @throws IllegalArgumentException thrown if the parser cannot handle the given feed type.
63      * @throws FeedException thrown if a feed bean cannot be created out of the XML document (JDOM).
64      *
65      */

66     public WireFeed parse(Document document, boolean validate) throws IllegalArgumentException JavaDoc,FeedException;
67
68
69 }
70
Popular Tags