Misplaced Pages

SimpleXML

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Not to be confused with the variant of the XML language, Simple XML.
The topic of this article may not meet Misplaced Pages's general notability guideline. Please help to demonstrate the notability of the topic by citing reliable secondary sources that are independent of the topic and provide significant coverage of it beyond a mere trivial mention. If notability cannot be shown, the article is likely to be merged, redirected, or deleted.
Find sources: "SimpleXML" – news · newspapers · books · scholar · JSTOR (November 2011) (Learn how and when to remove this message)

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.

Functions

  • addAttribute()
  • 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.

References

  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".

External links

PHP
People
Resources
Implementations
Web frameworks
Testing
ORMs
IDEs
Widget toolkit


Stub icon

This programming-language-related article is a stub. You can help Misplaced Pages by expanding it.

Categories: