コード例 #1
0
 /**
  * Gets be called on opening Tags like: <Tag> Can provide attribute(s), when xml was like: <Tag
  * attribute="attributeValue">
  */
 @Override
 public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
     throws SAXException {
   super.startElement(namespaceURI, localName, qName, atts);
   if (localName.equals("channel")) {
     this.inChannelTag = true;
     String id = atts.getValue("id");
     String sid = atts.getValue("spotId");
     if (id != null) {
       mChannel = new Channel(Integer.parseInt(id));
       if (sid != null) {
         mChannel.setSpotId(Integer.parseInt(sid));
       }
     }
   } else if (localName.equals("name")) {
     this.inNameTag = true;
   } else if (localName.equals("user")) {
     this.inUserTag = true;
   } else if (localName.equals("genre")) {
     this.inGenreTag = true;
   } else if (localName.equals("musics")) {
     this.inMusicsTag = true;
   } else if (localName.equals("creation")) {
     this.inCreationTag = true;
   } else if (localName.equals("update")) {
     this.inLastUpdateTag = true;
   }
 }