XML_Unserializer::setOption PHP Method

setOption() public method

You can use this method if you do not want to set all options in the constructor
public setOption ( string $name, mixed $value ) : void
$name string name of option
$value mixed value of option
return void
    function setOption($name, $value)
    {
        $this->options[$name] = $value;
    }

Usage Example

 /**
  * Test unserializing from UTF-8 to ISO-8859-1
  */
 public function testUtf8ToIso()
 {
     $u = new XML_Unserializer();
     $u->setOption(XML_UNSERIALIZER_OPTION_ENCODING_SOURCE, 'UTF-8');
     $u->setOption(XML_UNSERIALIZER_OPTION_ENCODING_TARGET, 'ISO-8859-1');
     $xml = '<xml>' . utf8_encode('A string containing ü ä Ãê') . '</xml>';
     $u->unserialize($xml);
     $this->assertEquals('A string containing ü ä Ãê', $u->getUnserializedData());
 }
All Usage Examples Of XML_Unserializer::setOption