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

Source for file Serializer_Bug7112.php

Documentation is available at Serializer_Bug7112.php

  1. <?php
  2. require_once 'XML/Serializer.php';
  3.  
  4. $citation =  array('book' =>
  5.                 array(
  6.                     'author' => array(
  7.                          array('John Doe''attributes' => array('id' => 1)),
  8.                          array('Bob Jones''attributes' =>array('id' => 2))
  9.                     ),
  10.                     'title' => 'Title of the book'
  11.                   )
  12.                );
  13.  
  14. $s = new XML_Serializer();
  15. $s->setOption(XML_SERIALIZER_OPTION_INDENT'    ');
  16. $s->setOption(XML_SERIALIZER_OPTION_ATTRIBUTES_KEY'attributes');
  17. $s->serialize($citation);
  18.  
  19. echo '<pre>';
  20. echo htmlentities($s->getSerializedData());
  21. echo '</pre>';
  22. ?>

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