| 1. |
How To Use Of E4x With Xml? |
|
Answer» USING E4X we can EASILY use JAVASCRIPT with an XML. Example:I have written an XML document. <order> We can stroe this XML document as an string in variable order. var order = new XML(txt) or Assign the XML text to the XML object variable directly. var order = new XML() We can also calculate the price like that, var total=order.item.qty * order.item.priceCan we display the customers full name like that, document.write(order.customer.lastname) We can calculate the total price, when the order has many items like that, var price=0for each (i in order.item) Using E4X we can easily use JAvAScript with an XML. Example:I have written an XML document. <order> We can stroe this XML document as an string in variable order. var order = new XML(txt) or Assign the XML text to the XML object variable directly. var order = new XML() We can also calculate the price like that, var total=order.item.qty * order.item.priceCan we display the customers full name like that, document.write(order.customer.lastname) We can calculate the total price, when the order has many items like that, var price=0for each (i in order.item) |
|