public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { System.out.println("::XMLParser::startElement::" + qName + ":" + atts); if (qName.equalsIgnoreCase(TAG_DOC)) { mDoc = true; mWikiDoc = new WikipediaDocument(); String id = atts.getValue("id"); if (id != null && id.trim().length() > 0) { mWikiDoc.setId(Integer.parseInt(id)); } String url = atts.getValue("url"); if (url != null && url.trim().length() > 0) { mWikiDoc.setWikilink(url); } String title = atts.getValue("title"); if (title != null && title.trim().length() > 0) { mWikiDoc.setTitle(title); } String timestamp = atts.getValue("timestamp"); if (timestamp != null && timestamp.trim().length() > 0) { mWikiDoc.setTimestamp(timestamp); } } }
public void endElement(String uri, String localName, String qName) throws SAXException { System.out.println("::XMLParser::EndElement::" + qName + "\n"); if (qName.equalsIgnoreCase(TAG_DOC)) { // System.out.println(mText); mWikiDoc.setText(mText); mCollWikiDoc.add(mWikiDoc); mDoc = false; mWikiDoc = null; mText = ""; // throw new SAXException(); } }