Results 1 to 7 of 7

Thread: Javascript XML Parser Question

  1. #1
    Join Date
    Aug 2012

    Question Javascript XML Parser Question

    Hello Everybody.

    First of all Im sorry because of my english.

    I have a working project with a php script, but i'd like to "convert" it to java, so in this way it could be a client side "application".
    (Maybe the Thread's title wrong so i try to explane it.)

    I have an xml file (with http:// address) and i want read and display specific parts of it in a html page.

    XML structure example:


    <name>Example 1</name>
    <writer>Somebody 1</writer>

    <name>Example 2</name>
    <writer>Somebody 2</writer>

    <name>Example 3</name>
    <writer>Somebody 3</writer>



    If i want to display example the second book's informations in a html page, like:

    Name: Example 2
    Pages: 558
    Writer:Somebody 2
    Limit: 221

    What script should I use?

    Please be patient im really new in this.

    Thank You Guys.

  2. #2
    Join Date
    Jan 2005
    Ideally, you should look at running an XSLT script on your server, but that will not be possible for everyone, so next thought is to read you file in with AJAX

  3. #3
    Join Date
    Jan 2009
    It might be easier to convert the xml results to JSON within your PHP. If you load in the xml to an array you can quickly export JSON with json_encode(). Then as omnicity suggested you can use AJAX to ask the php script for results in JSON ready for use.

  4. #4
    Join Date
    Aug 2012
    Thank you guys for the fast reply, but i think you misunderstand me
    I'd like to use a java script insteed of php. If i use java the client can handle it and i dont need to use a webserver to run the php script.

    So i need a javascript to do the xml parser.

  5. #5
    Join Date
    Jan 2009
    It would really be a much better idea to use the server-side to do the heavy lifting...but it can be done in Javascript, look up AJAX and I bet you'll find answers to your questions.

  6. #6
    Join Date
    Aug 2012
    Yes, i found several article, and i tryed to create a working code, but as i mentioned before i can't use java.
    I was hoping that maybe someone can atleast grab an example from any article and convert it to my project.
    If smbody would do that i could extend the script to my claim.
    Thank you!

  7. #7
    Join Date
    Jul 2008
    urbana, il
    you can do it using the dom and ajax to fetch the xml document.
    xml is a pain in javascript, but it's more than possible to use it.

    read up w3schools's ajax + xml sections.
    Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Recent Articles