-1
我有如下的xml數據,我想檢索所有站名,id和流派。如何做到這一點使用JavaScript?使用Javascript的解析器XML數據
<somelist>
<datatune base="/sbin/somelist.pls" base-m3u="/sbin/tunein-station.m3u" base-xspf="/sbin/tunein-station.xspf"/>
<list name="COOLfahrenheit 93 - (1)" mt="audio/mpeg" id="1392941" br="64" genre="Easy Listening" genre2="Pop" logo="http://i.radionomy.com/document/radios/3/32d2/32d25a06-b423-4d16-9541-7980a2669da3.png" ct="The TOYS - +I2+2'5HA%I'" lc="3220"/>
<list name="COOLfahrenheit 93 - (5)" mt="audio/mpeg" id="1453011" br="64" genre="Easy Listening" genre2="Pop" logo="http://i.radionomy.com/document/radios/f/f9a7/f9a74fd5-f1d4-41c1-9f8a-fcc62470bb31.png" ct="The TOYS - +I2+2'5HA%I'" lc="2348"/>
<list name="COOLfahrenheit 93 - (4)" mt="audio/aacp" id="1460193" br="64" genre="Easy Listening" genre2="Pop" logo="http://i.radionomy.com/document/radios/f/f6d5/f6d5d27f-397e-4b67-8564-8f043b2b5336.png" ct="The TOYS - +I2+2'5HA%I'" lc="1915"/>
</somelist>
感謝,
您可以使用與HTML,'getElementByID()','getElementsByTagName()'等相同的函數。試試看看它是否有效 – jrook
https://developer.mozilla.org/en -US /文檔/網絡/指南/ Parsing_and_serializing_XML – jrook