SimpleXML is a PHP extension that allows users to easily[1][2] manipulate/use XML data. It was introduced in PHP 5 as an object oriented approach to the XML DOM providing an object that can be processed with normal property selectors and array iterators.[3][4] It represents an easy way of getting an element's attributes and textual content if you know the XML document's structure or layout.[5]

Compared to DOM or the Expat parser, SimpleXML takes a fewer lines of code to read text data from an element.[6][7]

Functions

edit
  • addAttribute()[8]
  • addChild()
  • asXML()
  • attributes()
  • children()
  • __construct()
  • getDocNamespaces()
  • getName()
  • getNamespaces()
  • registerXPathNamespace()
  • xpath()
  • simplexml_import_dom
  • simplexml_load_file
  • simplexml_load_string

Error handling

edit

It is possible to suppress all XML errors when loading the document and then iterate over the errors.[9]

References

edit
  1. ^ "Introducing SimpleXML in PHP 5". 12 June 2006.
  2. ^ "PHP: SimpleXML - Manual".
  3. ^ Richards, Robert (2007-02-05). Pro PHP XML and Web Services. Apress. ISBN 9781430201397.
  4. ^ PHP.net SimpleXML intro
  5. ^ onlamp introduction to SimpleXML
  6. ^ w3schools SimpleXML Tutorial
  7. ^ "PHP Master | Parsing XML with SimpleXML". 11 February 2013.
  8. ^ "PHP: SimpleXMLElement::addAttribute - Manual".
  9. ^ "PHP: Dealing with XML errors - Manual".
edit


📚 Artikel Terkait di Wikipedia

List of PHP extensions

expressions Semaphores SESAM Session Handling Shared memory SMTP SNMP SimpleXML Sockets SQLite Streams Sybase Token vpopmail WDDX Win32 API xajax XML

List of open-source code libraries

PHPMailer PHP LGPL RedBeanPHP PHP BSD Simple Cloud API PHP Apache 2.0 SimpleXML PHP PHP Symfony PHP MIT Twig PHP BSD XHP PHP, Hack MIT Rocket Rust MIT

List of PHP software and tools

application development Silverstripe CMS – content management system SimpleXML – extension that allows users to easily manipulate/use XML data Slim —

Silverstripe CMS

PHP extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer and xml. The gd or imagick extension for image manipulation