public static function xml2data(SimpleXMLElement $xml, &$data, $item = 'item', $id = 'id')
{
foreach ($xml->children() as $items) {
$key = $items->getName();
$attr = $items->attributes();
if ($key == $item && isset($attr[$id])) {
$key = strval($attr[$id]);
}
if ($items->count()) {
self::xml2data($items, $val);
} else {
$val = strval($items);
}
$data[$key] = $val;
}
}