Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Elements
- */
- @Override
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) throws SAXException {
- super.startElement(uri, localName, qName, attributes);
- _dataField = new StringBuilder();
- if(qName.equalsIgnoreCase("item"))
- {
- Log.v(TAG, "Creating new item");
- _currRSSItem = new RSSItem();
- }
- else if(qName.equalsIgnoreCase("title"))
- {
- Log.v(TAG, "reseting title");
- _currTitle = "";
- }
- else if(qName.equalsIgnoreCase("description"))
- {
- Log.v(TAG, "reseting title");
- _currDescription = "";
- }
- else if(qName.equalsIgnoreCase("pubdate"))
- {
- Log.v(TAG, "reseting pubdate");
- _currPubdate = "";
- }
- else if(qName.equalsIgnoreCase("link"))
- {
- Log.v(TAG, "reseting link");
- _currLink = "";
- }
- }
- @Override
- public void characters(char[] ch, int start, int length)
- throws SAXException {
- _dataField.append(ch, start, length);
- }
- @Override
- public void endElement(String uri, String localName, String qName)
- throws SAXException {
- super.endElement(uri, localName, qName);
- if(qName.equalsIgnoreCase("title"))
- {
- Log.v(TAG, "Setting title to " + _dataField.toString());
- _currTitle = _dataField.toString();
- }
- else if(qName.equalsIgnoreCase("description"))
- {
- Log.v(TAG, "Setting desc to " + _dataField.toString());
- _currDescription = _dataField.toString();;
- }
- else if(qName.equalsIgnoreCase("pubdate"))
- {
- Log.v(TAG, "Setting pubdate to " + _dataField.toString());
- _currPubdate = _dataField.toString();
- }
- else if(qName.equalsIgnoreCase("link"))
- {
- Log.v(TAG, "Setting link to " + _dataField.toString());
- _currLink = _dataField.toString();
- }
- else if(qName.equalsIgnoreCase("item"))
- {
- Log.v(TAG, "Item complete, creating and adding it to the itemlist");
- _currRSSItem.setTitle(_currTitle);
- _currRSSItem.setDescription(_currDescription);
- _currRSSItem.setLink(_currLink);
- _currRSSItem.setPubdate(_currPubdate);
- _RSSItemList.add(_currRSSItem);
- }
- }
- public ArrayList<RSSItem> getRSSItemList()
- {
- return _RSSItemList;
- }
Add Comment
Please, Sign In to add comment