hi There!
I am writing to import my XML data into my JavaScript or in simple html file.
Environment:
1. I have an Java applet where I select some computer components. Applet has the following structure
Prudcut Picker
Motherboard Processor
1. Intel 1. Intel P3
2. Asus A 2. Intel P4
3. Asus A2 3. Intel P4
and so on so forth.
When I press “complete button” it give me the entire selected components list in the form of a string:
ASUS A2 Motherboard,ASUS A Motherboard,Intel P3 CPU,Intel P4 1.6 CPU (sperated by comma.
2. I have an XML file called components.xml file is pasted bellow;
3. I want to make an invoice at run time based on selected components using my xml file. Can any body help me out to do that? I will really appreciate if someone gives me solution for my problem… Actually, I have to use several xml files to do the similar work
Here is my simple html file that I tried to do my assignment..but I have gave-up now.
<!—GetArry.html starts here 
<HTML><HEAD></HEAD><BODY>
<SCRIPT>
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"
function getJavaArrayAsAString() {
var arrayAsAString = "Shahid|Hamid|Sajid|Last|One more|";
<!-- document.myApplet.getJavaArrayAsAString();*/
realJsString = arrayAsAString + "";
arrayFromJava = realJsString.split("|"
alert("Java Array length = " + arrayFromJava.length + "\r\n" +
"element 2 is " + arrayFromJava[1]);
-->
<!-- document.write("Total VAlue are <b>"+arrayFromJava.length+"</b><br/>" -->
<!-- document.write("Arra String is <p><b>"+arrayAsAString+"</b><br/>" -->
document.write("<from>"
for (i=0 ; i <= arrayFromJava.length-1 ; i++) {
document.write("<br><font=arial bgcolor=red><b>"+arrayFromJava+"</b><td width=100 height=6><input type='text' name='hcqty' size=5 maxlength=3 value=0></td></font><br/>"
/* onchange="if (isNaN(parseInt(OrderForm.hcqty.value))) {OrderForm.hctotal.value=0; OrderForm.hcqty.value=0}; else OrderForm.hctotal.value=subtotal(eval(OrderForm.hcqty.value),eval(35));"
onblur="OrderForm.gtotal.value='$'+total(this.form);" value="0"></b></font>
*/
}
document.write("</from>"
}
</SCRIPT>
<FORM>
xmlDoc.async="false"
xmlDoc.load("components.xml"
document.write(xmlDoc.getElementsByTagName("from".item(0).text)
document.write(xmlDoc.getElementsByTagName("from".item(0).text)
/* <INPUT type="button" value="get JAVA array (as a string)"
onClick = "getJavaArrayAsAString();"> */
</FORM>
</BODY></HTML>
<!—GetArray.html ends here 
Please help me out.
.hbari
Toronto, Canada
<!—Components.xml file starts here 
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/css" href="components.css"?>
<!DOCTYPE ComputerType SYSTEM "components.dtd">
<ComputerType>
<MotherBoard availability="yes" RamOnBoard="128" RamSlot="1">
<manufacturer>Sasha Inc.</manufacturer>
<MBType>Asus A</MBType>
<price>$150</price>
<DeliveryDate>4 Days</DeliveryDate>
</MotherBoard>
<MotherBoard availability="yes" RamOnBoard="128" RamSlots="2">
<manufacturer>Sasha Inc</manufacturer>
<MBType>Intel</MBType>
<price>$175</price>
<DeliveryDate>4 Days</DeliveryDate>
</MotherBoard>
<MotherBoard availability="yes" RamOnBoard="128" RamSlots="2">
<manufacturer>Sasha Inc</manufacturer>
<MBType>Asus A2</MBType>
<price>$200</price>
<DeliveryDate>4 Days</DeliveryDate>
</MotherBoard>
<CPU availability="yes">
<manufacturer>Intel Inc</manufacturer>
<Specification>Intel P3 550Mhz</Specification>
<price>$200</price>
<DeliveryDate>4 Days</DeliveryDate>
</CPU>
<CPU availability="yes">
<manufacturer>Intel Inc</manufacturer>
<Specification>Intel P4 1.6Ghz</Specification>
<price>$250</price>
<DeliveryDate>4 Days</DeliveryDate>
</CPU>
<CPU availability="yes">
<manufacturer>Intel Inc</manufacturer>
<Specification>Intel P4 2.0Ghz </Specification>
<price>$290</price>
<DeliveryDate>4 Days</DeliveryDate>
</CPU>
</ComputerType>
<!—components.xml files ends here 
I am writing to import my XML data into my JavaScript or in simple html file.
Environment:
1. I have an Java applet where I select some computer components. Applet has the following structure
Prudcut Picker
Motherboard Processor
1. Intel 1. Intel P3
2. Asus A 2. Intel P4
3. Asus A2 3. Intel P4
and so on so forth.
When I press “complete button” it give me the entire selected components list in the form of a string:
ASUS A2 Motherboard,ASUS A Motherboard,Intel P3 CPU,Intel P4 1.6 CPU (sperated by comma.
2. I have an XML file called components.xml file is pasted bellow;
3. I want to make an invoice at run time based on selected components using my xml file. Can any body help me out to do that? I will really appreciate if someone gives me solution for my problem… Actually, I have to use several xml files to do the similar work
Here is my simple html file that I tried to do my assignment..but I have gave-up now.
<!—GetArry.html starts here 
<HTML><HEAD></HEAD><BODY>
<SCRIPT>
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"
function getJavaArrayAsAString() {
var arrayAsAString = "Shahid|Hamid|Sajid|Last|One more|";
<!-- document.myApplet.getJavaArrayAsAString();*/
realJsString = arrayAsAString + "";
arrayFromJava = realJsString.split("|"
alert("Java Array length = " + arrayFromJava.length + "\r\n" +
"element 2 is " + arrayFromJava[1]);
-->
<!-- document.write("Total VAlue are <b>"+arrayFromJava.length+"</b><br/>" -->
<!-- document.write("Arra String is <p><b>"+arrayAsAString+"</b><br/>" -->
document.write("<from>"
for (i=0 ; i <= arrayFromJava.length-1 ; i++) {
document.write("<br><font=arial bgcolor=red><b>"+arrayFromJava+"</b><td width=100 height=6><input type='text' name='hcqty' size=5 maxlength=3 value=0></td></font><br/>"
/* onchange="if (isNaN(parseInt(OrderForm.hcqty.value))) {OrderForm.hctotal.value=0; OrderForm.hcqty.value=0}; else OrderForm.hctotal.value=subtotal(eval(OrderForm.hcqty.value),eval(35));"
onblur="OrderForm.gtotal.value='$'+total(this.form);" value="0"></b></font>
*/
}
document.write("</from>"
}
</SCRIPT>
<FORM>
xmlDoc.async="false"
xmlDoc.load("components.xml"
document.write(xmlDoc.getElementsByTagName("from".item(0).text)
document.write(xmlDoc.getElementsByTagName("from".item(0).text)
/* <INPUT type="button" value="get JAVA array (as a string)"
onClick = "getJavaArrayAsAString();"> */
</FORM>
</BODY></HTML>
<!—GetArray.html ends here 
Please help me out.
.hbari
Toronto, Canada
<!—Components.xml file starts here 
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/css" href="components.css"?>
<!DOCTYPE ComputerType SYSTEM "components.dtd">
<ComputerType>
<MotherBoard availability="yes" RamOnBoard="128" RamSlot="1">
<manufacturer>Sasha Inc.</manufacturer>
<MBType>Asus A</MBType>
<price>$150</price>
<DeliveryDate>4 Days</DeliveryDate>
</MotherBoard>
<MotherBoard availability="yes" RamOnBoard="128" RamSlots="2">
<manufacturer>Sasha Inc</manufacturer>
<MBType>Intel</MBType>
<price>$175</price>
<DeliveryDate>4 Days</DeliveryDate>
</MotherBoard>
<MotherBoard availability="yes" RamOnBoard="128" RamSlots="2">
<manufacturer>Sasha Inc</manufacturer>
<MBType>Asus A2</MBType>
<price>$200</price>
<DeliveryDate>4 Days</DeliveryDate>
</MotherBoard>
<CPU availability="yes">
<manufacturer>Intel Inc</manufacturer>
<Specification>Intel P3 550Mhz</Specification>
<price>$200</price>
<DeliveryDate>4 Days</DeliveryDate>
</CPU>
<CPU availability="yes">
<manufacturer>Intel Inc</manufacturer>
<Specification>Intel P4 1.6Ghz</Specification>
<price>$250</price>
<DeliveryDate>4 Days</DeliveryDate>
</CPU>
<CPU availability="yes">
<manufacturer>Intel Inc</manufacturer>
<Specification>Intel P4 2.0Ghz </Specification>
<price>$290</price>
<DeliveryDate>4 Days</DeliveryDate>
</CPU>
</ComputerType>
<!—components.xml files ends here 