简体   繁体   中英

How to store the data string into an array

I have a problem which has left me confused.

This is the problem.

<Placemark>
    <name>Turn left onto Jalan Raden Ajeng Kartini</name>
<description><![CDATA[go 550&#160;m]]></description>
<StyleMap>
<Pair>
    <key>normal</key>
    <Style>
        <IconStyle>
        <Icon><href>http://maps.gstatic.com/intl/en_ALL/mapfiles/kml/paddle/pause.png</href></Icon>
        <hotSpot x="0.500000" y="0.000000" xunits="fraction" yunits="fraction" />
        </IconStyle>
        <ListStyle>
        <ItemIcon><href>http://maps.gstatic.com/intl/en_ALL/mapfiles/kml/paddle/pause-lv.png</href></ItemIcon>
        </ListStyle>
    </Style>
</Pair>
<Pair>
    <key>highlight</key>
    <Style>
        <IconStyle>
        <scale>1.300000</scale>
        <Icon><href>http://maps.gstatic.com/intl/en_ALL/mapfiles/kml/paddle/pause.png</href></Icon>
        <hotSpot x="0.500000" y="0.000000" xunits="fraction" yunits="fraction" />
        </IconStyle>
        <ListStyle>
        <ItemIcon><href>http://maps.gstatic.com/intl/en_ALL/mapfiles/kml/paddle/pause-lv.png</href></ItemIcon>
        </ListStyle>
    </Style>
</Pair>
</StyleMap>
<Point>
    <coordinates>106.827140,-6.296370,0</coordinates>
</Point>
<LookAt>
    <longitude>106.827140</longitude>
    <latitude>-6.296370</latitude>
    <range>100.000000</range>
    <tilt>45.000000</tilt>
    <heading>347.976074</heading>
</LookAt>
</Placemark>

In the tag Placemark we can see child tag <name>...</name> which contains String value like " Turn left onto jalan Raden Ajeng Kartini "

In my XML document I found many tag names such as this one. How do I save them to an Array?

I'm not quite sure what you are asking. But i think you need an XML parser for android.

I recommend reading the guide on this link: http://www.jondev.net/articles/Android_XML_SAX_Parser_Example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM