Menu
Home Explore People Places Arts History Plants & Animals Science Life & Culture Technology
On this page
SimpleXML
PHP extension that allows for manipulation and use of XML data

SimpleXML is a PHP extension that allows users to easily 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. It represents an easy way of getting an element's attributes and textual content if you know the XML document's structure or layout.

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

We don't have any images related to SimpleXML yet.
We don't have any YouTube videos related to SimpleXML yet.
We don't have any PDF documents related to SimpleXML yet.
We don't have any Books related to SimpleXML yet.
We don't have any archived web articles related to SimpleXML yet.

Functions

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

Error handling

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

References

  1. "Introducing SimpleXML in PHP 5". 12 June 2006. https://www.devshed.org/introducing-simplexml-in-php-5/

  2. "PHP: SimpleXML - Manual". http://www.php.net/manual/en/book.simplexml.php

  3. Richards, Robert (2007-02-05). Pro PHP XML and Web Services. Apress. ISBN 9781430201397. 9781430201397

  4. PHP.net SimpleXML intro http://www.php.net/manual/en/intro.simplexml.php

  5. onlamp introduction to SimpleXML http://onlamp.com/pub/a/php/2004/01/15/simplexml.html

  6. w3schools SimpleXML Tutorial https://www.w3schools.com/PHP/php_xml_simplexml_read.asp

  7. "PHP Master | Parsing XML with SimpleXML". 11 February 2013. http://www.sitepoint.com/parsing-xml-with-simplexml/

  8. "PHP: SimpleXMLElement::addAttribute - Manual". http://www.php.net/manual/en/simplexmlelement.addattribute.php

  9. "PHP: Dealing with XML errors - Manual". http://www.php.net/manual/en/simplexml.examples-errors.php