Posts

Write a script to solve following questions(use “Book.xml” file) A:- Create a Dom document object and load this xml file. B:- Get the output of this document to the browser. C:- Save this [.xml] document in another format that i.e. in [.doc]. D:- Write a xml program to print the names of the books available in “Book.xml” file.

Book.xml <?xml version="1.0" encoding="utf-8"?> <ABCBOOK>         <Technical>         <BOOK>         <Book_PubYear>ABC</Book_PubYear>         <Book_Title>pqr</Book_Title>         <Book_Author>400</Book_Author>         </BOOK>         </Technical>          <Cooking>         <BOOK>         <Book_PubYear>ABC</Book_PubYear>         <Book_Title>pqr</Book_Title>         <Book_Author>400</Book_Author>         </BOOK>...

Write an application where String is loaded from ”Dont_forget.xml”  file in php using simplexml_load_string().

Dont_forget.xml:::---   <?xml version='1.0' encoding='UTF-8'?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> Dont_forget.php:::--- <?php $xml=simplexml_load_string($myXMLData) or die("Error: Cannot create object"); print_r($xml); ?>

Create an XML file which gives details of books available in “ABC Bookstore” from following categories. 1)      Technical 2)      Cooking 3)      Yoga And elements in each category are in the following format.     …….     …….     ……. Save the file as “Book.xml” Create an application that reads “Book.xml” file into simple XML object. Display attributes and elements. (Hint:- Use simple_xml_load_file() function). 

Book.XML <?xml version="1.0" encoding="utf-8"?> <ABCBOOK>         <Technical>         <BOOK>         <Book_PubYear>ABC</Book_PubYear>         <Book_Title>pqr</Book_Title>         <Book_Author>400</Book_Author>         </BOOK>         </Technical>          <Cooking>         <BOOK>         <Book_PubYear>ABC</Book_PubYear>         <Book_Title>pqr</Book_Title>         <Book_Author>400</Book_Author>         </BOOK>...

Create an application that reads “Book.xml” into simple XML object. Display attributes and elements. (Hints:- use simplexml_load_file() function).

BOOK.XML <?xml version="1.0" encoding="utf-8"?> <BOOKINFO>       <BOOK>         <bookname>ABC</bookname>         <author>pqr</author>         <price>400</price>       </BOOK>       <BOOK>         <bookname>DEF</bookname>         <author>xyz</author>         <price>300</price>       </BOOK> </BOOKINFO> BOOK.PHP <?php     $xml=simplexml_load_file("Book.xml") or die("cannnot load");    $xmlstring=$xml->asXML();    echo $xmlstring; ?>

Write an Ajax program to print the content of the myfile.dat. This code asks the user to click a button, fetches data from the server using Ajax techniques and displays that data in the same web page as the button without refreshing the page

Fetch.php <html> <head> <script language="javascript"> varreq=false; if(window.XMLHttpRequest) { req=new XMLHttpRequest();  } else  if(window.ActiveXObject) { req=new ActiveXObject("Microsoft.XMLHttp"); } functionfetchdata(datasource,divID) { if(req)   { req.open("GET",datasource); req.onreadystatechange=function()                 { if(req.readyState==4 &&req.status==200)                     { document.getElementById(divID).innerHTML=req.responseText;                     }                } req.send(null);       }   } </script> </head> <body> <form> <input type...

Write a simple PHP program which implements Ajax for addition of two numbers

Add.php <html> <head>    <script language="javascript" src="ajax.js">    </script> </head> <body> <div id="txt" name="txt"></div>    <form action="javascript:add(document.getElementById('frm'));" name="frm" id="frm">   <table>    <tr>      <td>Enter first number : </td>      <td><input type="text" id="num1"></td>      </tr>      <tr>      <td>Enter second number : </td>      <td><input type="text" id="num2"></td>      </tr>      <tr>        <td colspan="2"><input type="submit" name="button" value="show"></td>      </tr> </table> </form> </body> ...

Write a PHP script to demonstrate the introspection for examining class(use function get_declared_classes() ,get_class_methods() and get_class_vars()).

<?php classMyclass           { public $a; public $b=10; public $c='ABC'; functionMyclass()             {               //Myclass function             } function myfun1()             {                //functin             } function myfun2()             {                //functin             }           } $class=get_declared_classes(); foreach($class as $cname) { echo"$c...