<XML id="po_xmldata"> <?xml version="1.0"?> <!DOCTYPE po_xmldata [ <!ELEMENT po_xmldata (company,po_num,po_date,po_line+)> <!ELEMENT company (#PCDATA) > <!ELEMENT po_num (#PCDATA) > <!ELEMENT po_date (mon,day,yr) > <!ELEMENT mon (#PCDATA) > <!ELEMENT day (#PCDATA) > <!ELEMENT yr (#PCDATA) > <!ELEMENT po_line (prod_num,prod_desc,prod_quant,price_each) > <!ELEMENT prod_num (#PCDATA) > <!ELEMENT prod_desc (#PCDATA) > <!ELEMENT prod_quant (#PCDATA) > <!ELEMENT price_each (#PCDATA) > ]> <po_xmldata> <company>Acme Drilling Supply</company> <po_num>ABC4455</po_num> <po_date> <mon>April</mon><day>15</day><yr>2008</yr></po_date> <po_line> <prod_num>K142</prod_num> <prod_desc>Casing Bolt</prod_desc> <prod_quant>726</prod_quant> <price_each>1.29</price_each> </po_line> . ...6 po_line tags omitted . <po_line> <prod_num>K201</prod_num> <prod_desc>Mud Mix 100 pounds</prod_desc> <prod_quant>129</prod_quant> <price_each>111.04</price_each> </po_line> </po_xmldata> </XML> |
1. (50 points) A purchase order is stored in XML and is embedded in an HTML page with id=po_xmldata (the DTD and a portion of the XML data are shown to the left). When a button labelled "GO" (as shown below) Click thhis button for the Answer Click "View", the "Source" to see the code
(1) a po_line counter ("Item" and numbered: 1,2,3...)
"Item Total" is the product of prod_quant multiplied by price_each. The last table row contains the sum of the "Item Total" values. For po_line data use: root.childNodes(i).childNodes(j).text where i begins at 3 and continues to root.childNodes.length and j ranges from 0 to 3 (i.,e. for the four po_line tag values). Show the javascript for p1. Show NO HTML. Show NO XML. |
2. (50 points) A gif file named sredball.gif (![]() Then Click "View", then "Source" to see the code |