0

I am making an web audio player, with it is linked to an xml file, so for each track the xml file will have the following items:

<track>
    <singer></singer>
    <title></title>
    <url></url>
    <artwork></artwork>
    <downloadURL></downloadURL>
</track>

There will be many different tracks with all these items for each one of them. How can I store them in my application? I was thinking to have a loop function to create one array for each track so if there are 20 tracks, there will be 20 arrays. I am looking for the usual solution for this.

Any idea?

TheGuy
  • 427
  • 2
  • 4
  • 12
  • You're gonna want to parse it to a js object, by storing it as JSON. Take a look at [this answer](http://stackoverflow.com/a/1773571/1179430) – GAntoine Jan 06 '16 at 03:17
  • The xml seems to be your storage. Are you looking for a way to parse it and then use it? If you would have it all in JSON you could just get the JSON and do JSON.parse(tracksInJson) and get everything as objects and arrays, however you order the JSON. – E. Sundin Jan 06 '16 at 03:20
  • @ArcaneCraeda Well I prefer to use xml cuz it is easier for basic-users to modify it and add their tracks. I could figure out hot to parse it by ajax, but I need suggestions about storing the data in the application. it should not be must efficient to access the xml file each time i need a data. So I was wondering should I create one array for the data of each 'track' OR one array for all tracks' data? Or any other possible way to localise the data from xml. – TheGuy Jan 06 '16 at 03:45
  • @E.Sundin thanks for your comment. please read my comment above. – TheGuy Jan 06 '16 at 03:45

0 Answers0