dcsimg
www.webdeveloper.com
Results 1 to 7 of 7

Thread: How do I import data ?

  1. #1
    Join Date
    Oct 2003
    Location
    Toronto, Canada
    Posts
    2

    Question How do I import data ?

    Hello Everyone,
    I am very new to XML and I have never written XML code before. At work I maintain an internal website that provides information to our agents on the phones in a large call center. I wanted to create an XML file that updates itself twice daily with data from a seperate text file. For example, I want it to display foreign exchange rates twice daily. I wanted the rates to be in a simple text file that the XML file can import it from.
    First, I wanted to know if this can be done or should I be approaching this in a different manner. Second, is there somewhere I can download a similar example that I can modify to my liking?
    Thank-you for feedback you may have.

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,136
    you will have to understand that XML itself is nothing but a fancy text file,to make it work as you desire,you will need some complimentory technologies
    such as java or any other programming language.
    You will need to write a program that will read the text fiel and update the xml file.

    I am sure this is not what you'd expected as an answer.
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  3. #3
    Join Date
    Sep 2003
    Location
    Australia
    Posts
    37
    Exactly Khalid, the XML wont do it by itself, insetad you will have to make someone-something to do it eg: Java, Javascript etc etc...


  4. #4
    Join Date
    Oct 2003
    Location
    Toronto, Canada
    Posts
    2

    Question Just So I Understand

    So you are saying that I need a Javascript file, (since I have some experience with this language), to read the text file, and I would use a XML file to display the info from the text file on my web page ? Is this correct ?

  5. #5
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,136
    Not quite,
    because JavaScript can not read /write fiels on any given system.

    to read XML/JavaSCript capabilities read this

    Again you will need some other hard core programming language to read and write to fiels.
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  6. #6
    Join Date
    Sep 2003
    Location
    Australia
    Posts
    37
    welll here are a few directions to read frm a text file and store in XML...

    1.using the FileSystemObject in Javascript u would be able to read the file and assign data to a variable.....

    2. Use that variable in XMLDOM object and the function LoadXML()....

    3. Now save it....see..its simple

  7. #7
    Join Date
    Jul 2003
    Location
    Bergen, Norway
    Posts
    103
    ...Or you could just use an HTML page to display the contents of your XML file... Here's an example:


    XML FILE:

    <?xml version="1.0">
    <exchange>
    <usa>5</usa>
    <canada>3</canad>
    </exchange>

    HTML FILE:

    <html>
    <head>
    <title>HTML_FILE</title>
    <script language=JavaScript>
    <!--
    var RootElement1;
    var xmlDoc1=new ActiveXObject("microsoft.xmldom");
    xmlDoc1.load("xml_file.xml");

    function StartUp()
    {
    if(xmlDoc1.readyState=="4")
    {
    StartLoading();
    }
    else
    {
    alert("Loading operation could not start");
    }
    }

    function StartLoading()
    {
    RootElement1=xmlDoc1.documentElement;
    usadata.innerText=RootElement1.childNodes(0).text;
    canadadata.innerText=RootElement1.childNodes(1).text;
    }

    //-->
    </script>
    </head>
    <body>
    USA:&nbsp;<span id=usadata>/span><br>
    CANADA:&nbsp;<span id=canadadata></span>
    </body>
    </html>

    This is just a simple example... but... uuh... yes, that's true, you use JavaScript to display it, so this reply was unnecessary.

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