0

アプリにリレーショナル データが必要です。そのデータは、assetsフォルダーに保存されるか、Server.

categories(id, name, slug) // using a slug string to select the category icon drawable in list view
places(id, name, ...., category_id)
images(id, path, place_id)

これに基づいて、次の XML を構築しました。

カテゴリ.xml

<?xml version="1.0" encoding="utf-8"?>
<categories>
    <category>
        <name>Hill Station</name>
        <icon>hill-station</icon>
    </category>

    <category>
        <name>Water Fall</name>
        <icon>water-fall</icon>
    </category>
.
.
.
.

</categories>

場所.xml

<places>
    <place>
        <name>Nandi hills</name>
        <category>hill-station</category>
        <distance>70</distance>
        <days>1</days>
        <latitude>13.3333</latitude>
        <longitude>77.6500</longitude>
        <weather>Summer 25°-28°C, Winter 8°-10°C</weather>
        <todo>Para-Gliding, Tippu Drop, Gardens, Jumping Jacks</todo>
        <about>Nandi Hills or Nandidurg is an ancient hill fortress of southern India, 
            in the Chikkaballapur district of Karnataka state. It is located just 10 km from 
            Chickballapur town and approximately 60 km from the city of Bangalore. The hills are 
            nestled between the neighboring towns of Nandi, Muddenahalli, and Kanivenarayanapura.
            The hills are traditionally held as the origin of the Arkavathy river.
        </about>
        <images>
            <image>http://i.imgur.com/Y2MMa.jpg</image>
            <image>http://i.imgur.com/DoRXC.jpg</image>
            <image>http://i.imgur.com/ZA8PR.jpg</image>
            <image>http://i.imgur.com/aSeYa.jpg</image>
        </images>
    </place>

    <place>
        <name>Kemmannugundi</name>
        <category>hill-station</category>
        <distance>260</distance>
        <days>2</days>
        <latitude>13.5470</latitude>
        <longitude>75.7580</longitude>
        <weather>Summer 17°-34°C, Winter 12°-29°C</weather>
        <todo>Rajendra hill, Rock garden, Z point, Shiva temple</todo>
        <about>Kemmannugundi is a hill station in Tarikere taluk of Chikkamagaluru district in the state of Karnataka, India. 
            It is 1434m above sea level. This was the summer retreat of Krishnaraja Wodeyar IV and as a mark of respect to the king, 
            it is also known as Sri Krishnarajendra Hill Station. The station is ringed by the Baba Budan Giri Range, with cascades, 
            mountain streams, and lush vegetation, Kemmangundi’s has ornamental gardens and mountains and valleys views. 
            There is a spectacular sunset view from the Raj Bhavan.</about>
        <images>
            <image>http://i.imgur.com/Y2MMa.jpg</image>
            <image>http://i.imgur.com/DoRXC.jpg</image>
            <image>http://i.imgur.com/ZA8PR.jpg</image>
            <image>http://i.imgur.com/aSeYa.jpg</image>
        </images>
    </place>
</places>

現在、OrderXMLHandler を使用してデータを解析しています。XMLを解析してオブジェクトを自動的に提供できるライブラリはありますか?

4

1 に答える 1

1

キャスターを見てください。私は何年も前にそれを使用しました。現在も活動中のプロジェクトのようです。XML/オブジェクトの整列化/非整列化を提供します: http://castor.codehaus.org/index.html

JAXB は同じ機能を提供しますが、Android で JAXB を実行すると問題があると聞きました (つまり、確認していません)。

于 2013-01-06T04:54:13.030 に答える