@param \SimpleXMLElement|array $xmlObject
@param array                   $output

@return array
430033
public function xmlToArray($xmlObject, $output = array())
    {
        foreach ((array) $xmlObject as $index => $node) {
            $output[$index] = ($node instanceof \SimpleXMLElement || is_array($node))
                ? $this->xmlToArray($node)
                : $node;
        }

        return $output;
    }
331367
protected function processEntryNode($xmlArray)
    {
        $entry = [];
        $entryItem = $xmlArray[Resources::ENTRY];

        if (is_array($entryItem)) {
            foreach ($xmlArray[Resources::ENTRY] as $entryXmlInstance) {
                $entryInstance = new Entry();
                $entryInstance->fromXml($entryXmlInstance);
                $entry[] = $entryInstance;
            }
        } else {
            $entryInstance = new Entry();
            $entryInstance->fromXml($entryItem);
            $entry[] = $entryInstance;
        }

        return $entry;
    }
1202508
public static void writeXml(Serializable serializable, OutputStream output) throws IOException {
		TransportFormat.XML.writeSerializableTo(serializable, output);
	}
171029
public function parseListOutput($output, array $arguments = array())
    {
        if (!isset($arguments['--xml']) || false === $arguments['--xml']) {
            // non xml results are not supported
            return $output;
        }

        $head = $this->getClient()->getHead();

        $sxml = simplexml_load_string($output);

        $retval = array();
        foreach ($sxml->xpath('//entry') as $item) {
            $filename = (string) $item->name;
            $kind     = (string) $item->attributes()->kind;
            $revision = (string) $item->commit->attributes()->revision;
            $date     = (string) $item->commit->date;
            $author   = (string) $item->commit->author;

            $commit = new Commit($revision, new \DateTime($date), $author);

            $file = new VcsFileInfo($filename, $head, $kind);
            $file->setCommit($commit);

            $retval[] = $file;
        }

        return $retval;
    }
260567
public function replyXml(array $data, $isReturn = false)
    {
        $xml = Tools::arr2xml($data);
        if ($isReturn) {
            return $xml;
        }
        ob_clean();
        exit($xml);
    }
378875
public function serialize($resource, OutputStream $out): OutputStream
    {
        $out->write($this->xmlSerializerFacade->serializeToXml($resource));
        return $out;
    }
1371638
public function export_for_template(\renderer_base $output) {
        $value = $this->get_value();
        return (object)[
            'value' => $value,
            'type' => $this->get_type(),
            'shortname' => $this->get_shortname(),
            'name' => $this->get_name(),
            'hasvalue' => ($value !== null),
            'instanceid' => $this->data->get('instanceid')
        ];
    }
354579
protected function simpleXmlToArray(SimpleXMLElement $xml) {
		$result = [];
		
		foreach ($xml as $element) {
			$name    = $element->getName();
			$content = get_object_vars($element);
			
			if (isset($content['@attributes'])){
				if (isset($content['@attributes']['value'])) {
					$result[$name] = Std::parseValue($content['@attributes']['value']);
					continue;
				}
				
				unset($content['@attributes']);
			}
			
			if (empty($content)) {
				$result[$name] = Std::parseValue($element);
				continue;
			}
			
			$result[$name] = $this->simpleXmlToArray($element);
		}
		
		return $result;
	}
866006
public function xmlToArray($input = false) {

        if($input && Validate::isString($input)) {

            return simplexml_load_string($string);
        }

        return false;
    }
997999
protected function childToArray(SimpleXmlElement $xml, $name)
    {
        if (!isset($xml->{$name})) {
            return array();
        }

        return $xml->{$name}->toPhpValue('array');
    }
991533
function &outputText()
    {
        if ( !$this->XMLData )
        {
            $output = '';
            return $output;
        }

        $this->Tpl = eZTemplate::factory();
        $this->Res = eZTemplateDesignResource::instance();
        if ( $this->ContentObjectAttribute )
        {
            $this->Res->setKeys( array( array( 'attribute_identifier', $this->ContentObjectAttribute->attribute( 'contentclass_attribute_identifier' ) ) ) );
        }

        $this->Document = new DOMDocument( '1.0', 'utf-8' );
        $success = $this->Document->loadXML( $this->XMLData );

        if ( !$success )
        {
            $this->Output = '';
            return $this->Output;
        }

        $this->prefetch();

        $this->XMLSchema = eZXMLSchema::instance();

        // Add missing elements to the OutputTags array
        foreach( $this->XMLSchema->availableElements() as $element )
        {
            if ( !isset( $this->OutputTags[$element] ) )
            {
                 $this->OutputTags[$element] = array();
             }
        }

        $this->NestingLevel = 0;
        $params = array();

        $output = $this->outputTag( $this->Document->documentElement, $params );
        $this->Output = $output[1];

        unset( $this->Document );

        $this->Res->removeKey( 'attribute_identifier' );
        return $this->Output;
    }
155137
public static function toArray($obj)
    {
        if ($obj instanceof DOMNode) {
            $obj = simplexml_import_dom($obj);
        }
        if (!($obj instanceof SimpleXMLElement)) {
            throw new XmlException('The input is not instance of SimpleXMLElement, DOMDocument or DOMNode.');
        }
        $result = [];
        $namespaces = array_merge(['' => ''], $obj->getNamespaces(true));
        static::_toArray($obj, $result, '', array_keys($namespaces));

        return $result;
    }
192940
static function simpleXmlToArray(SimpleXMLElement &$source)
  {
    $res = array();
    $children = false;
    foreach ($source as $key => $value) {
        CPS_Response::simpleXmlToArrayHelper($res, $key, $value, $children);
    }
    if ($source) {
      foreach ($source->children('www.clusterpoint.com') as $key => $value) {
        $newkey = 'cps:' . $key;
        CPS_Response::simpleXmlToArrayHelper($res, $newkey, $value, $children);
      }
    }
    if (!$children)
      return (string)$source;
    return $res;
  }
238436
public function getMarkerObject($xml, $settings)
    {
        return [
            'title' => $this->title,
            'subtitle' => $this->subtitle,
            'latitude' => $this->latitude,
            'longitude' => $this->longitude,
            'html' => $xml->saveXML($this->getHTMLNode($xml, $settings))
        ];
    }
221535
public static function XML2Array($xmlString)
    {
        try {
            $xml    = simplexml_load_string($xmlString, "SimpleXMLElement",
                LIBXML_NOCDATA);
            $json   = json_encode($xml);
            $result = json_decode($json, TRUE);
        } catch (\Exception $ex) {
            $result = '';
        }
        return $result;
    }
485392
public function extract($xmltext)
    {
        try {
            $object     = simplexml_load_string($xmltext, 'SimpleXMLElement', LIBXML_NOCDATA);
            $encrypt    = $object->Encrypt;
            $tousername = $object->ToUserName;

            return [0, $encrypt, $tousername];
        } catch (Exception $e) {
            //print $e . "\n";
            return [ErrorCode::$ParseXmlError, null, null];
        }
    }
279947
private function arrayToXml(array &$data, SimpleXMLElement $xmlData)
    {
        foreach ($data as $key => $value) {
            $key = ltrim($key, '_');

            if (\is_array($value)) {
                if (\is_numeric($key)) {
                    $key = 'resource';
                }

                if (false === empty($value[JsonTransformer::LINKS_HREF])) {
                    $subnode = $xmlData->addChild('link');
                    $subnode->addAttribute('rel', $key);

                    foreach ($this->linkKeys as $linkKey) {
                        if (!empty($value[$linkKey])) {
                            $subnode->addAttribute($linkKey, $value[$linkKey]);
                        }
                    }
                } else {
                    if (!empty($value[JsonTransformer::LINKS_KEY][JsonTransformer::LINK_SELF][JsonTransformer::LINKS_HREF])) {
                        $subnode = $xmlData->addChild('resource');
                        $subnode->addAttribute(
                            JsonTransformer::LINKS_HREF,
                            $value[JsonTransformer::LINKS_KEY][JsonTransformer::LINK_SELF][JsonTransformer::LINKS_HREF]
                        );

                        if ($key !== 'resource') {
                            $subnode->addAttribute('rel', $key);
                        }
                    } else {
                        $subnode = $xmlData->addChild($key);
                    }
                }

                $this->arrayToXml($value, $subnode);
            } else {
                if ($key !== JsonTransformer::LINKS_HREF) {
                    if ($value === true || $value === false) {
                        $value = ($value) ? 'true' : 'false';
                    }

                    $xmlData->addChild("$key", '<![CDATA['.html_entity_decode($value).']]>');
                }
            }
        }
    }