SimpleXML
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
- 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
- https://www.devshed.org/introducing-simplexml-in-php-5/
- http://www.php.net/manual/en/book.simplexml.php
- Richards, Robert (2007-02-05). Pro PHP XML and Web Services. ISBN 9781430201397.
- PHP.net SimpleXML intro
- onlamp introduction to SimpleXML
- w3schools SimpleXML Tutorial
- http://www.sitepoint.com/parsing-xml-with-simplexml/
- http://www.php.net/manual/en/simplexmlelement.addattribute.php
- http://www.php.net/manual/en/simplexml.examples-errors.php
External links
- PHP.net's SimpleXML manual
- AIP Conf. Proc. 1497, pp. 395-401; Speed up of XML parsers with PHP language implementation
- devshed SimpleXML Tutorial
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.