Page 340 - Open Soource Technologies 304.indd
P. 340

Web Technologies-I



                   Notes         printf(“ISBN: %s<br>”, $book[‘isbn’]);
                                 printf(“Comment: %s<p>\n”, $book[‘comment’]);
                                 }

                                 ?> Back to the <a href=”<?= $_SERVER[‘PHP_SELF’] ?>”>list of books</a>.<p>
                                 <?

                                 }
                                 }; // main program code
                                 $my_library = new BookList (“books.xml”);
                                 if ($_GET[‘isbn’])

                                 {
                                 // return info on one book

                                 $my_library->show_book($_GET[‘isbn’]);
                                 }
                                 Else
                                 { // show menu of books

                                 $my_library->show_menu( );
                                 }
                                 ?>

                                 </body>
                                 </html>




                                               Develop a program to parse an XML file which contains information on a set
                                             of books.

                                 Self Assessment

                                 Multiple choice questions:
                                    1.   XML stands for

                                       (a)  External Markup Language   (b)  Expandable Markup Language
                                       (c)  Extensible Markup Language   (d)  None of these
                                    2.  Which is the correct tag for xml?
                                       (a)  <?xml version=”1.0” ?>     (b)  <?xml version=”1.0” !>
                                       (c)  <!xml version=”1.0” !>     (d)  None of these
                                    3.  To find the error in the xml code we use the function.
                                       (a)  xml_get_error_code( )      (b)  xml_error_code( )

                                       (c)  xml_get_error( )           (d)  All of above




        334                               LOVELY PROFESSIONAL UNIVERSITY
   335   336   337   338   339   340   341   342   343   344   345