Beispiel #1
0
    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);
        }
      }
    }