private function WSDecoderXML::decodeXml in Web Service Data 8
Same name and namespace in other branches
- 2.0.x src/Plugin/WSDecoder/WSDecoderXML.php \Drupal\wsdata\Plugin\WSDecoder\WSDecoderXML::decodeXml()
XML Parsing helper function, converts nested XML objects into arrays.
1 call to WSDecoderXML::decodeXml()
- WSDecoderXML::decode in src/
Plugin/ WSDecoder/ WSDecoderXML.php - Decode the web service response string.
File
- src/
Plugin/ WSDecoder/ WSDecoderXML.php, line 55
Class
- WSDecoderXML
- XML Decoder.
Namespace
Drupal\wsdata\Plugin\WSDecoderCode
private function decodeXml($value) {
if (is_object($value) and get_class($value)) {
$value = get_object_vars($value);
foreach ($value as $k => $v) {
$value[$k] = $this
->decodeXml($v);
}
}
elseif (is_array($value)) {
foreach ($value as $key => $xml) {
$value[$key] = $this
->decodeXml($xml);
}
}
return $value;
}