Download presentation
Presentation is loading. Please wait.
Published byHadian Kusumo Modified over 7 years ago
1
SIMPLE XML ELEMENT Disusun oleh : Tora Fahrudin., M.T
Hanya untuk kepentingan pengajaran di lingkungan Fakultas Ilmu Terapan MI3234 – Pemrosesan Data XML Semester Genap 2014/2015 SIMPLE XML ELEMENT Disusun oleh : Tora Fahrudin., M.T Diajar oleh : Tora Fahrudin., M.T.
2
Simple XML Element Kemudahan membuat tag XML (Element, Attribut)
3
Simple XML Element Contoh implementasi XML Element
<?php $xmlstr = "<?xml version='1.0' ?>\n". // optionally you can specify a xml-stylesheet for presenting the results. just uncoment the following line and change the stylesheet name. /* "<?xml-stylesheet type='text/xsl' href='xml_style.xsl' ?>\n". */ "<book></book>"; // create the SimpleXMLElement object with an empty <book> element $xml = new SimpleXMLElement($xmlstr); // add some child nodes $xml->addChild("title", "Title of my book"); $xml->addChild("abstract", "My book is about learning to work with SimpleXMLElement"); // add some more child nodes $chapter1 = $xml->addChild("chapter_1"); // add an attribute to child chapter_1 $chapter1->addAttribute("chapter_title", "Introduction to my book"); $chapter2 = $xml->addChild("chapter_2"); $chapter2->addAttribute("chapter_title", "Development of my book"); $chapter3 = $xml->addChild("chapter_3"); $chapter3->addAttribute("chapter_title", "Another chapter of my book"); $conclusion = $xml->addChild("conclusion", "The ending of my book"); // insert the header to tell the browser how to read the document header("Content-type: text/xml"); // print the SimpleXMLElement as a XML well-formed string echo $xml->asXML(); ?>
4
Simple XML Element Contoh implementasi XML Element
<?php $xmlstr = "<?xml version='1.0' ?>\n". // optionally you can specify a xml-stylesheet for presenting the results. just uncoment the following line and change the stylesheet name. /* "<?xml-stylesheet type='text/xsl' href='xml_style.xsl' ?>\n". */ "<book></book>"; // create the SimpleXMLElement object with an empty <book> element $xml = new SimpleXMLElement($xmlstr); // add some child nodes $xml->addChild("title", "Title of my book"); $xml->addChild("abstract", "My book is about learning to work with SimpleXMLElement"); // add some more child nodes $chapter1 = $xml->addChild("chapter_1"); // add an attribute to child chapter_1 $chapter1->addAttribute("chapter_title", "Introduction to my book"); $chapter2 = $xml->addChild("chapter_2"); $chapter2->addAttribute("chapter_title", "Development of my book"); $chapter3 = $xml->addChild("chapter_3"); $chapter3->addAttribute("chapter_title", "Another chapter of my book"); $conclusion = $xml->addChild("conclusion", "The ending of my book"); // insert the header to tell the browser how to read the document header("Content-type: text/xml"); // print the SimpleXMLElement as a XML well-formed string echo $xml->asXML(); ?>
5
Simple XML Element Contoh implementasi XML Element
CREATE TABLE `pelanggan` ( `id_pelanggan` int(4) NOT NULL DEFAULT '0', `nama_pelanggan` varchar(20) DEFAULT NULL, `alamat` varchar(30) DEFAULT NULL, ` ` varchar(20) DEFAULT NULL, PRIMARY KEY (`id_pelanggan`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `pelanggan` VALUES ('1', 'Maemunah', 'Sukabirus', INSERT INTO `pelanggan` VALUES ('2', 'Jubaedah', 'Sukapura', INSERT INTO `pelanggan` VALUES ('3', 'Rochaedah', 'PGA',
6
Daftar Pustaka http://www.w3.org/XML/Linking
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.