December 1999
Intermediate to advanced
992 pages
22h 3m
English
As you learned in Chapter 15, DOM gives us an extremely effective method of searching an XML document. Also, for occasional searches, this and a script are all that programs will need to search an XML document. Listing 22.5 searches movies.xml for all title elements.
<html> <title>DOM XQL functions</title> <!--use your own source path!!→ <xml id ="isle" src=" movies.xml"></xml> <script> xDoc=isle if(xDoc.parseError!=0) {alert(xDoc.parseError.reason)} else { var dummy=getQuery("title") alert(dummy) } function getQuery(x) { var returnString= "<xql:return> \n" var tagList=xDoc.getElementsByTagName(x) for (var i=0;i<tagList.length;i++) { returnString=returnString +"<" + x +">" returnString=returnString ... |
Read now
Unlock full access