如何通过在xml中使用引用idref来获取标记的内容

时间:2018-01-16 12:32:07

标签: c++ xml rapidxml

这是我的代码。

<music>
    <songs>
        <song id="song1">
            <song_name>taxi taxi</song_name>
            <artist_idref idref="artist2"/>
            <album_idref idrefs="album1 album2"/>
        </song>
        <song id="song2">
            <song_name>vennilave</song_name>
            <artist_idref idrefs="artist1 artist2"/>
            <album_idref idrefs="album2"/>
        </song>
    </songs>
    <artists>
        <artist id="artist1">
            <artist_name>spb</artist_name>
            <songsOfArtist idrefs="song2"/>
        </artist>
        <artist id="artist2">
            <artist_name>aadhi</artist_name>
            <songOfArtist idrefs="song1 song2"/>
        </artist>
    </artists>
    <albums>
        <album id="album1">
            <album_name>hiphop</album_name>
            <songsOfAlbum idrefs="song1"/>
        </album>
        <album id="album2">
            <album_name>melody</album_name>
            <songsOfAlbum idrefs="song1 song2"/>
        </album>
    </albums>
</music>

我想获取idrefs song1 song2的内容并显示内容。 当我显示专辑细节时,它会显示歌曲ID(即)song1 song2。而不是我想要显示那首歌名。

0 个答案:

没有答案