| 1 | |
package net.spy.digg.parsers; |
| 2 | |
|
| 3 | |
import java.io.IOException; |
| 4 | |
|
| 5 | |
import org.w3c.dom.Document; |
| 6 | |
import org.w3c.dom.NodeList; |
| 7 | |
import org.xml.sax.SAXException; |
| 8 | |
|
| 9 | |
import net.spy.digg.Story; |
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | 12 | public class StoriesParser extends TimePagedItemParser<Story> { |
| 15 | |
|
| 16 | |
@Override |
| 17 | |
protected String getRootElementName() { |
| 18 | 12 | return "stories"; |
| 19 | |
} |
| 20 | |
|
| 21 | |
@Override |
| 22 | |
protected void handleDocument(Document doc) |
| 23 | |
throws SAXException, IOException { |
| 24 | 12 | parseCommonFields(doc); |
| 25 | |
|
| 26 | 12 | final NodeList nl=doc.getElementsByTagName("story"); |
| 27 | 279 | for(int i=0; i<nl.getLength(); i++) { |
| 28 | 267 | addItem(new StoryImpl(nl.item(i))); |
| 29 | |
} |
| 30 | 12 | } |
| 31 | |
} |