source/Core/SimpleXml.php
protected function _addChildNode($oXml, $sKey, $mElement, $sPreferredKey = null)
    {
        $aAttributes = [];
        if (is_array($mElement) && array_key_exists('attributes', $mElement) && is_array($mElement['attributes'])) {
            $aAttributes = $mElement['attributes'];
            $mElement = $mElement['value'];
        }

        if (is_object($mElement) || is_array($mElement)) {
            if (is_int(key($mElement))) {
                $this->_addSimpleXmlElement($oXml, $mElement, $sKey);
            } else {
                $oChildNode = $oXml->addChild($sPreferredKey? $sPreferredKey : $sKey);
                $this->_addNodeAttributes($oChildNode, $aAttributes);
                $this->_addSimpleXmlElement($oChildNode, $mElement);
            }
        } else {
            $oChildNode = $oXml->addChild($sPreferredKey? $sPreferredKey : $sKey, $mElement);
            $this->_addNodeAttributes($oChildNode, $aAttributes);
        }

        return $oXml;
    }
protected function _addChildNode($oXml, $sKey, $mElement, $sPreferredKey = null)
    {
        $aAttributes = [];
        if (is_array($mElement) && array_key_exists('attributes', $mElement) && is_array($mElement['attributes'])) {
            $aAttributes = $mElement['attributes'];
            $mElement = $mElement['value'];
        }

        if (is_object($mElement) || is_array($mElement)) {
            if (is_int(key($mElement))) {
                $this->_addSimpleXmlElement($oXml, $mElement, $sKey);
            } else {
                $oChildNode = $oXml->addChild($sPreferredKey? $sPreferredKey : $sKey);
                $this->_addNodeAttributes($oChildNode, $aAttributes);
                $this->_addSimpleXmlElement($oChildNode, $mElement);
            }
        } else {
            $oChildNode = $oXml->addChild($sPreferredKey? $sPreferredKey : $sKey, $mElement);
            $this->_addNodeAttributes($oChildNode, $aAttributes);
        }

        return $oXml;
    }
protected function _addChildNode ( $ oXml , $ sKey , $ mElement , $ sPreferredKey = null ) { $ aAttributes = [ ] ; if ( is_array ( $ mElement ) && array_key_exists ( 'attributes' , $ mElement ) && is_array ( $ mElement [ 'attributes' ] ) ) { $ aAttributes = $ mElement [ 'attributes' ] ; $ mElement = $ mElement [ 'value' ] ; } if ( is_object ( $ mElement ) || is_array ( $ mElement ) ) { if ( is_int ( key ( $ mElement ) ) ) { $ this -> _addSimpleXmlElement ( $ oXml , $ mElement , $ sKey ) ; } else { $ oChildNode = $ oXml -> addChild ( $ sPreferredKey ? $ sPreferredKey : $ sKey ) ; $ this -> _addNodeAttributes ( $ oChildNode , $ aAttributes ) ; $ this -> _addSimpleXmlElement ( $ oChildNode , $ mElement ) ; } } else { $ oChildNode = $ oXml -> addChild ( $ sPreferredKey ? $ sPreferredKey : $ sKey , $ mElement ) ; $ this -> _addNodeAttributes ( $ oChildNode , $ aAttributes ) ; } return $ oXml ; }
Adds child node to given simple xml object.

@param SimpleXMLElement    $oXml
@param string              $sKey
@param string|array|object $mElement
@param string              $sPreferredKey

@return SimpleXMLElement
Adds child node to given simple xml object .