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.  
  10.     require_once 'XML/Unserializer.php';
  11.  
  12.     $options = array(
  13.                         "parseAttributes"   =>  true,
  14.                         "attributesArray"   =>  false
  15.                     );
  16.     
  17.     //  be careful to always use the ampersand in front of the new operator 
  18.     $unserializer &new XML_Unserializer($options);
  19.  
  20.     // userialize the document
  21.     $status $unserializer->unserialize("example.xml"true);    
  22.  
  23.     if (PEAR::isError($status)) {
  24.         echo    "Error: " $status->getMessage();
  25.     else {
  26.         $data $unserializer->getUnserializedData();
  27.  
  28.         echo    "<pre>";
  29.         print_r$data );
  30.         echo    "</pre>";
  31.     }
  32. ?>

Documentation generated on Mon, 11 Mar 2019 10:15:35 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.