Re: [Vala] parsing an xml file



Check at
live.gnome.org/Vala/XmlExample

Or

live.gnome.org/XML

El lunes 19 de septiembre de 2011, Dennis Kerrisk <dennis psaudio com>
escribió:
Hi,
               I am new to vala, and would like to know how to parse an
xml file into string variables? Here is an example xml file I need to parse:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE PsAudio Gapless Album Info>
<PsAudioGaplessAlbumInfo version="1.0">
   <CurrentTrack>
       <title>No Pain for the Dead</title>
       <trackNumber>8</trackNumber>
       <discNumber>0</discNumber>
   </CurrentTrack>
   <Album>
       <album>Temple of Shadows</album>
       <albumArtist>Angra</albumArtist>
   </Album>
   <TrackList>
       <track>
           <title>Deus le Volt!</title>
           <artists>Angra</artists>
           <position>0</position>
           <trackNumber>1</trackNumber>
           <discNumber>0</discNumber>
           <duration>52</duration>
           <position>0</position>
       </track>
       <track>
           <title>Spread Your Fire</title>
           <artists>Angra</artists>
           <position>52</position>
           <trackNumber>2</trackNumber>
           <discNumber>0</discNumber>
           <duration>265</duration>
           <position>52</position>
       </track>
       <track>
           <title>Angels and Demons</title>
           <artists>Angra</artists>
           <position>317</position>
           <trackNumber>3</trackNumber>
           <discNumber>0</discNumber>
           <duration>251</duration>
           <position>317</position>
       </track>
       <track>
           <title>Waiting Silence</title>
           <artists>Angra, 30 Seconds to Mars, Akvarium</artists>
           <position>568</position>
           <trackNumber>4</trackNumber>
           <discNumber>0</discNumber>
           <duration>295</duration>
           <position>568</position>
       </track>
       <track>
           <title>Wishing Well</title>
           <artists>Angra</artists>
           <position>863</position>
           <trackNumber>5</trackNumber>
           <discNumber>0</discNumber>
           <duration>240</duration>
           <position>863</position>
       </track>
       <track>
           <title>The Temple of Hate</title>
           <artists>Angra</artists>
           <position>1103</position>
           <trackNumber>6</trackNumber>
           <discNumber>0</discNumber>
           <duration>313</duration>
           <position>1103</position>
       </track>
       <track>
           <title>The Shadow Hunter</title>
           <artists>Angra</artists>
           <position>1416</position>
           <trackNumber>7</trackNumber>
           <discNumber>0</discNumber>
           <duration>485</duration>
           <position>1416</position>
       </track>
       <track>
           <title>No Pain for the Dead</title>
           <artists>Angra</artists>
           <position>1901</position>
           <trackNumber>8</trackNumber>
           <discNumber>0</discNumber>
           <duration>305</duration>
           <position>1901</position>
       </track>
       <track>
           <title>Winds of Destination</title>
           <artists>Angra</artists>
           <position>2206</position>
           <trackNumber>9</trackNumber>
           <discNumber>0</discNumber>
           <duration>416</duration>
           <position>2206</position>
       </track>
       <track>
           <title>Sprouts of Time</title>
           <artists>Angra</artists>
           <position>2622</position>
           <trackNumber>10</trackNumber>
           <discNumber>0</discNumber>
           <duration>309</duration>
           <position>2622</position>
       </track>
       <track>
           <title>Morning Star</title>
           <artists>Angra</artists>
           <position>2931</position>
           <trackNumber>11</trackNumber>
           <discNumber>0</discNumber>
           <duration>460</duration>
           <position>2931</position>
       </track>
       <track>
           <title>Late Redemption</title>
           <artists>Angra</artists>
           <position>3391</position>
           <trackNumber>12</trackNumber>
           <discNumber>0</discNumber>
           <duration>295</duration>
           <position>3391</position>
       </track>
       <track>
           <title>Gate XIII</title>
           <artists>Angra</artists>
           <position>3686</position>
           <trackNumber>13</trackNumber>
           <discNumber>0</discNumber>
           <duration>303</duration>
           <position>3686</position>
       </track>
   </TrackList>
</PsAudioGaplessAlbumInfo>


Dennis Kerrisk | Senior Linux Firmware Engineer  |   PS Audio
4826 Sterling Drive, Boulder, CO 80301
Ph 720-406-8946 x123
www.psaudio.com<http://www.psaudio.com>
dennis psaudio com<mailto:jim psaudio com>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]