src/Common/Internal/Serialization/XmlSerializer.php
private function _arr2xml(XMLWriter $xmlW, array $data, $defaultTag = null)
    {
        foreach ($data as $key => $value) {
            if ($key === Resources::XTAG_ATTRIBUTES) {
                foreach ($value as $attributeName => $attributeValue) {
                    $xmlW->writeAttribute($attributeName, $attributeValue);
                }
            } elseif (is_array($value)) {
                if (!is_int($key)) {
                    if ($key != Resources::EMPTY_STRING) {
                        $xmlW->startElement($key);
                    } else {
                        $xmlW->startElement($defaultTag);
                    }
                }

                $this->_arr2xml($xmlW, $value);

                if (!is_int($key)) {
                    $xmlW->endElement();
                }
            } else {
                $xmlW->writeElement($key, $value);
            }
        }
    }
private function _arr2xml(XMLWriter $xmlW, array $data, $defaultTag = null)
    {
        foreach ($data as $key => $value) {
            if ($key === Resources::XTAG_ATTRIBUTES) {
                foreach ($value as $attributeName => $attributeValue) {
                    $xmlW->writeAttribute($attributeName, $attributeValue);
                }
            } elseif (is_array($value)) {
                if (!is_int($key)) {
                    if ($key != Resources::EMPTY_STRING) {
                        $xmlW->startElement($key);
                    } else {
                        $xmlW->startElement($defaultTag);
                    }
                }

                $this->_arr2xml($xmlW, $value);

                if (!is_int($key)) {
                    $xmlW->endElement();
                }
            } else {
                $xmlW->writeElement($key, $value);
            }
        }
    }
private function _arr2xml ( XMLWriter $ xmlW , array $ data , $ defaultTag = null ) { foreach ( $ data as $ key => $ value ) { if ( $ key === Resources :: XTAG_ATTRIBUTES ) { foreach ( $ value as $ attributeName => $ attributeValue ) { $ xmlW -> writeAttribute ( $ attributeName , $ attributeValue ) ; } } elseif ( is_array ( $ value ) ) { if ( ! is_int ( $ key ) ) { if ( $ key != Resources :: EMPTY_STRING ) { $ xmlW -> startElement ( $ key ) ; } else { $ xmlW -> startElement ( $ defaultTag ) ; } } $ this -> _arr2xml ( $ xmlW , $ value ) ; if ( ! is_int ( $ key ) ) { $ xmlW -> endElement ( ) ; } } else { $ xmlW -> writeElement ( $ key , $ value ) ; } } }
Takes an array and produces XML based on it.

@param XMLWriter $xmlW       XMLWriter object that was previously instanted
and is used for creating the XML
@param array     $data       Array to be converted to XML
@param string    $defaultTag Default XML tag to be used if none specified
Takes an array and produces XML based on it .