Space for google add

XML - “Course.xml”.



 Write a script to create XML file named “Course.xml”

<Course>

<Computer Science>

<Student name>.......</Student name>

<Class name>......</Class name>

<percentage>.....</percentage>

</Computer Science>

</Course>

Store the details of 5 students who are in TYBSc.


course.php

<html>

<head><link ref="stylesheet" type="text/css" href="course.css"></head>

<body>

<?php

echo '<head><link ref="stylesheet" type="text/css" href="course.css"></head>';

$course=new simpleXMLElement("<Course></Course>");

$cs=$course->addChild("Computer_Science");

$cs->addChild("Student_Name","Rupali");

$cs->addChild("Class_Name","TYBCS");

$cs->addChild("Percentage","72");


$cs->addChild("Student_Name","Ritika");

$cs->addChild("Class_Name","TYBCS");

$cs->addChild("Percentage","82");


$cs->addChild("Student_Name","Avdhoot");

$cs->addChild("Class_Name","SYBCS");

$cs->addChild("Percentage","62");


$cs->addChild("Student_Name","Sonali");

$cs->addChild("Class_Name","SYBCS");

$cs->addChild("Percentage","55");


$cs->addChild("Student_Name","Revati");

$cs->addChild("Class_Name","TYBCS");

$cs->addChild("Percentage","72");


$course->asXML("test.xml");

echo '<a href="test.xml">Click Here</a>';

?>

</body>

</html>




Post a Comment

0 Comments