Hello and welcome to our community! Is this your first visit?
Register
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
    Posts
    1
    Thanks
    0
    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

    <playlist>

    <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>

    </playlist>

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

    http://www.codetoad.com/xml_javascripti_tutorial.asp

    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
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,302
    Thanks
    28
    Thanked 276 Times in 270 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
    •