0

saxパーサーを使用して2つの異なるタグ(CreatedClubとJoinedClub)の応答を解析し、応答を2つの異なるリストビューに更新する必要がありますか? 私の回答は次のとおりです。

<root> 
    <CreatedClub>
        <rows>
            <Cid>3590</Cid>
            <ClubName>Rockets</ClubName>
            <ClubAddress>A-44A,Sector-16</ClubAddress>
            <ClubCity>Noida</ClubCity>
            <ClubLatitude>28.5775157</ClubLatitude>
            <ClubLongitude>77.3159296</ClubLongitude>
            <ClubCreatedDate>2013-05-16T08:30:29.21-04:00</ClubCreatedDate>
            <photoPath>0</photoPath>
        </rows>
    </CreatedClub>
    <JoinedClub>
        <rows>
            <Cid>512</Cid>
            <ClubName>Delhi Rockets</ClubName> 
            <ClubAddress>New Friends Colony</ClubAddress>
            <ClubCity>New Delhi</ClubCity>
            <ClubLatitude>28.5670488</ClubLatitude>
            <ClubLongitude>77.2735599</ClubLongitude> 
            <ClubCreatedDate>2013-01-10T16:26:39.707-05:00</ClubCreatedDate>
            <photoPath>0</photoPath>
        </rows>
    </JoinedClub>
</root>              
4

1 に答える 1

0

これを試して

public void startElement(String uri, String localName, String qName,
            Attributes attributes) throws SAXException {
    super.startElement(uri, localName, qName, attributes);
    if (localName.equalsIgnoreCase("CreatedClub")) {
        //add to list1
    }else if (localName.equalsIgnoreCase("JoinedClub")) {
        //add to list2
        }

}
于 2013-05-23T12:09:42.217 に答える