children(Splunk_AtomFeed::NS_S)->dict;
$listValue = $containerXml->children(Splunk_AtomFeed::NS_S)->list;
if (Splunk_XmlUtil::elementExists($dictValue))
{
return Splunk_AtomFeed::parseDict($dictValue);
}
else if (Splunk_XmlUtil::elementExists($listValue))
{
return Splunk_AtomFeed::parseList($listValue);
}
else // value is scalar
{
return Splunk_XmlUtil::getTextContent($containerXml);
}
}
/*
* Example of $dictXml:
*
*
* v1
* v2
*
*/
private static function parseDict($dictXml)
{
$dict = array();
foreach ($dictXml->children(Splunk_AtomFeed::NS_S)->key as $keyXml)
{
$key = Splunk_XmlUtil::getAttributeValue($keyXml, 'name');
$value = Splunk_AtomFeed::parseValueInside($keyXml);
$dict[$key] = $value;
}
return $dict;
}
/*
* Example of $listXml:
*
*
* e1
* e2
*
*/
private static function parseList($listXml)
{
$list = array();
foreach ($listXml->children(Splunk_AtomFeed::NS_S)->item as $itemXml)
$list[] = Splunk_AtomFeed::parseValueInside($itemXml);
return $list;
}
}