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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question loading external xml file using javascript

    i am trying to load a raw xml file into a form to be submitted as xml to a server which is then processed by a javaservlet.

    but its the getting the stored xml file to autofill the text area form field using javascript bring the contents in.
    there is a dropdown list that links to a file (or this is what i want it to do)which then autofills the textarea field which then the form can be submitted.

    ive looked for various ways to do this but im getting a bit lost

    the current state of affairs is :

    <HTML>
    <HEAD>
    <TITLE> Send XML</TITLE>
    <LINK rel="stylesheet" href="style.css" type="text/css">
    <script language="javascript" src="xmlstdalt.js"></script>

    </HEAD>
    <BODY>
    <form name="testformadmin" action="#" onSubmit="return testSbmit();">
    <select name="xmlstandard" size=1 onChange="showxmlstandard(testformadmin)">
    <option selected>Select XML Standard</option>
    <option value="XCBL20">XCBL 2.0</option>
    <option value="XCBL30">XCBL 3.0</option>
    <option value="XCBL35">XCBL 3.5</option>
    <option value="xcml10">XCML 1.0</option>
    </select><br><br>
    <textarea rows="8" cols="60" name="displayxmlstandard"></textarea><br>
    <input type="submit" value="Submit">
    </form>
    </body>
    </html>

    script as follows ( this just emulates whats listed in the option value)

    function showxmlstandard(thisform)
    {
    var myindex=thisform.xmlstandard.selectedIndex
    var thisrate = thisform.xmlstandard.options[myindex].value
    thisform.displayxmlstandard.value = thisrate
    }

    this bit i think would do what i want but i cant figure out how to link the 2 bits of script.

    var xmldoc=new ActiveXObject("MSXML2.DOMDocument.3.0");
    xmldoc.async = false;
    xmldoc.load("xmltest.xml");

    Thanks for any help in advance
    Last edited by brianfarnell; 08-24-2004 at 05:07 PM. Reason: little spelling mistake prob more

  • #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
    I am surprised you would not use Java (jsp) to do it since you are using Java from what I read in your post....

    but read this thread and see if it helps...

    xmlDoc.load() in Mozilla

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    java

    i am one of a larger team who are the java programmers that is why im not doing it in java yet it is a intrim solution i have been asked to do
    but thanks for the link im reading it now

  • #4
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by brianfarnell
    i am one of a larger team who are the java programmers
    i'm in a similar situation, working mainly on the view using JSTL and Struts, but thankfully as yet not the hardcore Java.

    anyway, are you able to use JSTL on your project. it comes with XML parsing functionality, and you won't have touch the hardstuff to do it
    *keep it simple (TM)


  •  

    Posting Permissions

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