Exemple #1
0
 /**
  * Parses and returns the value inside the specified XML element.
  * 
  * @param SimpleXMLElement $containerXml
  * @return mixed
  */
 public static function parseValueInside($containerXml)
 {
     $dictValue = $containerXml->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 {
             return Splunk_XmlUtil::getTextContent($containerXml);
         }
     }
 }
Exemple #2
0
 /**
  * @param SimpleXMLElement  $xml
  * @param string            $xpathExpr
  * @return string|NULL
  */
 public static function getTextContentAtXpath($xml, $xpathExpr)
 {
     $matchingElements = $xml->xpath($xpathExpr);
     return count($matchingElements) == 0 ? NULL : Splunk_XmlUtil::getTextContent($matchingElements[0]);
 }