View Full Version : loading external xml file using javascript

08-24-2004, 05:05 PM
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 :

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

<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>
<textarea rows="8" cols="60" name="displayxmlstandard"></textarea><br>
<input type="submit" value="Submit">

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;

Thanks for any help in advance

08-24-2004, 05:51 PM
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...



08-25-2004, 08:25 AM
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

08-25-2004, 09:27 AM
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 :)