Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
353
PHP SimpleXML: Function load_string
PHP Version: PHP 5
Description
Sometimes it is required to
convert a String( represents a well-formed XML String)
into a simpleXML object. Once you have the string, you can turn it into a simpleXML object using the simplexml_load_string() function.
simplexml_load_string -- Interprets a
string of XML into an object
Usage:
objectsimplexml_load_string (
string data [, string class_name])
This function will take the
well-formed xml string data and return an object with properties containing
the data held within the xml document. If any errors occur, it returns FALSE.
Example:
Try reading an XML string
with the simplexml_load_string() function first. All you need to do is supply a string to
the function. And once you have your simpleXML
object, you can use the objects asXML() function to display it as formatted XML.