Slip 22 - A) Create a XML file which gives details of books available in “Pragati Bookstore” from following categories. 1) Yoga 2) Story 3) Technical and elements in each category are in the following format -------------- - -- - - Save the file as “Bookcategory.xml”

Solution:

abcbook.xml


<?xml version="1.0"?>
<ABCBOOK>
<Technical>
<BOOK>
<Book_PubYear>ABC</Book_PubYear>
<Book_Title>pqr</Book_Title>
<Book_Author>400</Book_Author>
</BOOK>
</Technical>    

<Cooking>
<BOOK>
<Book_PubYear>BBC</Book_PubYear>
<Book_Title>pPr</Book_Title>
<Book_Author>500</Book_Author>
</BOOK>
</Cooking>    

<Yoga>
<BOOK>
<Book_PubYear>CBC</Book_PubYear>
<Book_Title>pRr</Book_Title>
<Book_Author>600</Book_Author>
</BOOK>
</Yoga>
</ABCBOOK>

abcbook.php


<?php
$xml=simplexml_load_file("abcbook.xml") or die("cannnot load");
$xmlstring=$xml->asXML();
echo $xmlstring;
?>

Post a Comment

0 Comments