elm1 Value
elm1 Value 2
elm2 Value
';
$results = array('root' =>
array(
'elm1' =>
array(
0 => array('value' => 'elm1 Value'),
1 => array('value' => 'elm1 Value 2')
),
'elm2' => array('value' => 'elm2 Value')
)
);
$this->assertEquals($results, BSXml::Parse($xml));
}
public function testInvalidXml()
{
$xml = 'soemValue';
try
{
BSXml::Parse($xml);
$this->fail('exception expcted');
}
catch (Exception $e)
{}
}
public function testUnifyNode()
{
$xml = '
elm1 Value
elm1 Value 2
elm2 Value
';
$array = BSXml::Parse($xml);
BSXml::UnifyNode($array['root']['elm2']);
$this->assertEquals($array['root']['elm2'][0]['value'], 'elm2 Value');
}
public function testUtf8Xml()
{
$xml = 'test: π';
$array = BSXml::Parse($xml, true);
$this->assertEquals($array['root']['utf8']['value'], 'test: π');
}
}
?>