Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Thanked 0 Times in 0 Posts

    Javascript read in from an xml file and output with write function

    Javascript read in from an xml file and output with write function

    That's the gist of it

    Hi Guys I'm new here, please go easy on me!

    Well you see what I'm trying to do is set up some code that will read in from my xml file (code to follow shortly)

    I have the xml file already and it contains information that is read by my flash jukebox.

    I'd like to know if it's possible to make that 1 file serve to purposes!

    I'm hoping someone can help me understand how I am to achieve this. I have been searching tirelessly for some tutorials relating to this, I found one but I have no idea how to get it to work as it is intended (I'll link that in a minute)

    So back to the problem, I want to read in from my xml page using javascript and then using a "javascript write" function, and would like it to display a page, that is the playlist

    ok an example of the xml page is here and it is called playlist.xml


    <item artist="artist 1" title="track 1" fileType="mp3" path="url/of/track/here" time="0:40"></item>

    <item artist="artist 2" title="track 2" fileType="mp3" path="url/of/track/here" time="3:27"></item>

    <item artist="artist 3" title="track 3" fileType="mp3" path="url/of/track/here" time="1:40"></item>

    <item artist="artist 4" title="track 4" fileType="mp3" path="url/of/track/here"></item>


    and a tutorial I found, which I thought sounded just like what I'm looking for can be found here:


    I've tried to get that to work, by firstly, creating the javascript file and then also the xml file

    I tried initially to set up an alert, just to see if it would work as it is intended. I was hoping that would work, so I could take it a step closer.

    But to no avail! :'(

    Please, Please, can somebody explain to me how I would achieve what I'm aiming for. a tutorial or explanation or any other form of help/learning would be muchly appreciated!

    I look forward to hearing your guys thoughts on this

    Thanks in advance!

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Between DC and Baltimore In a Cave
    Thanked 94 Times in 88 Posts
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Splendora, Texas, United States of America
    Thanked 292 Times in 286 Posts
    document.write() does not work in XML or XML-derived languages such as XHTML. Use DOM methods to output your code instead.

    What you’re seeing in that example is the use of data drawn from an XML file into an HTML file, sort of like this.
    For every complex problem, there is an answer that is clear, simple, and wrong.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts