XML_Serializer
[ class tree: XML_Serializer ] [ index: XML_Serializer ] [ all elements ]

Source for file unserializeWithAttributes.php

Documentation is available at unserializeWithAttributes.php

  1. <?PHP
  2. /**
  3.  * This example shows how to parse attributes from
  4.  * XML tags.
  5.  *
  6.  * @author  Stephan Schmidt <schst@php.net>
  7.  * @uses    example.xml
  8.  */
  9.     error_reporting(E_ALL);
  10.  
  11.     require_once 'XML/Unserializer.php';
  12.  
  13.     $options = array(
  14.                         "parseAttributes"   =>  true,
  15.                         "attributesArray"   =>  false
  16.                     );
  17.     
  18.     //  be careful to always use the ampersand in front of the new operator 
  19.     $unserializer &new XML_Unserializer($options);
  20.  
  21.     // userialize the document
  22.     $status $unserializer->unserialize("example.xml"true);    
  23.  
  24.     if (PEAR::isError($status)) {
  25.         echo    "Error: " $status->getMessage();
  26.     else {
  27.         $data $unserializer->getUnserializedData();
  28.  
  29.         echo    "<pre>";
  30.         print_r$data );
  31.         echo    "</pre>";
  32.     }
  33. ?>

Documentation generated on Mon, 11 Mar 2019 14:00:16 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.