-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwritexml.php
48 lines (33 loc) · 1.28 KB
/
writexml.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
$xml= new DomDocument("1.0","UTF-8");
$xml->formatOutput=true;
$xml->preserveWhiteSpace=false;
$studentregister=$xml->createElement("studentregister");
$studentregister=$xml->createElement("studentregister");
$xml->appendChild($studentregister);
$student=$xml->createElement("student");
$studentregister->appendChild($student);
$sssn=$xml->createElement("ssn",123);
$student->appendChild($sssn);
$sfname=$xml->createElement("fname","devin");
$student->appendChild($sfname);
$slname=$xml->createElement("lname","chandula");
$student->appendChild($slname);
$saddress=$xml->createElement("address","Hakmana");
$student->appendChild($saddress);
$semail=$xml->createElement("email","devinchandula@gmail.com");
$student->appendChild($semail);
$gender=$xml->createElement("gender","Male");
$student->appendChild($gender);
$bday=$xml->createElement("bday","05/25/1996");
$student->appendChild($bday);
$age=$xml->createElement("age",23);
$student->appendChild($age);
$paymethod=$xml->createElement("paymethod","cash");
$student->appendChild($paymethod);
$timeperiod=$xml->createElement("timeperiod","05/25/2026");
$student->appendChild($timeperiod);
$dcode=$xml->createElement("dcode",123);
$student->appendChild($dcode);
echo "<xmp>".$xml->saveXML()."</xmp>";
$xml->save("studentregister.xml");