1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 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,FeedException;
67
68
69 }