Class ChannelPullHandler
java.lang.Object
ChannelPullHandler
This class will parse a rss or rdf document and build a Map consisting of
- attributes of a channel
- and a one attribute "items" which is a list with items, where each item consists
of a Map with attributes.
NOTE: this class does not use namespaces and instead is based on heuristics
NOTE: this class does not use namespaces and instead is based on heuristics
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
This method will parse the input reader and return a Map.private List
parseFirst
(int type) This method will recursively parse the document, returning a List build of Key-Value pairs.private void
parseSecond
(List values) This method will loop over the found values and set the values for a channel, and set the values for each item.private void
workOnChannel
(List list) This method will set the attributes for a channel.private void
workOnItem
(List list) This method will set the item attributes.
-
Field Details
-
items
-
xmlPullParser
-
channel
-
channelIdentifiers
-
itemIdentifiers
-
channelSynonymes
The channelSynonymes consists of an array of identifiers. The first element of the array is the name that you want filled. The others names are synonymes that might be filled. These are all synonymes for channel attributes, for instance, you need the title attribute. If this isnt found initially, this class will look for an rss:title attribute. If found, it will copy the value of rss:title to title. These values could be moved out into a properties kind of file, e.g. url=link,dc:indentifier,rss:link -
itemSynonymes
The channelSynonymes consists of an array of identifiers. The first element of the array is the name that you want filled. The others names are synonymes that might be filled. These are all synonymes for item attributes
-
-
Constructor Details
-
ChannelPullHandler
- Throws:
XmlPullParserException
-
-
Method Details
-
parseFirst
This method will recursively parse the document, returning a List build of Key-Value pairs. A value can be a List again, indicating a nested element inside an element.- Parameters:
type
-- Returns:
- Throws:
IOException
XmlPullParserException
-
parseSecond
This method will loop over the found values and set the values for a channel, and set the values for each item. If other elements need to be supported, this is where you should check for these (e.g. images).- Parameters:
values
-
-
workOnItem
This method will set the item attributes.- Parameters:
list
-
-
workOnChannel
This method will set the attributes for a channel.- Parameters:
list
-
-
parse
This method will parse the input reader and return a Map. This map consists of : - the attributes of a channel - and a List with items, where each item is a Map again.- Parameters:
in
-- Returns:
- Throws:
XmlPullParserException
IOException
-
main
- Throws:
XmlPullParserException
IOException
-