protected function writeEl(XMLWriter $xml, $data)
    {
        foreach ($data as $key => $value) {
            if (\is_array($value) && !$this->isAssoc($value)) { //numeric array
                foreach ($value as $itemValue) {
                    if (\is_array($itemValue)) {
                        $xml->startElement($key);
                        $itemValue = $this->writeAttr($xml, $itemValue);
                        $this->writeEl($xml, $itemValue);
                        $xml->endElement();
                    } else {
                        $itemValue = $this->writeAttr($xml, $itemValue);
                        $xml->writeElement($key, "$itemValue");
                    }
                }
            } else if (\is_array($value)) { //associative array
                $xml->startElement($key);
                $value = $this->writeAttr($xml, $value);
                $this->writeEl($xml, $value);
                $xml->endElement();
            } else { //scalar
                $value = $this->writeAttr($xml, $value);
                $xml->writeElement($key, "$value");
            }
        }
    }
protected function writeEl(XMLWriter $xml, $data)
    {
        foreach ($data as $key => $value) {
            if (\is_array($value) && !$this->isAssoc($value)) { //numeric array
                foreach ($value as $itemValue) {
                    if (\is_array($itemValue)) {
                        $xml->startElement($key);
                        $itemValue = $this->writeAttr($xml, $itemValue);
                        $this->writeEl($xml, $itemValue);
                        $xml->endElement();
                    } else {
                        $itemValue = $this->writeAttr($xml, $itemValue);
                        $xml->writeElement($key, "$itemValue");
                    }
                }
            } else if (\is_array($value)) { //associative array
                $xml->startElement($key);
                $value = $this->writeAttr($xml, $value);
                $this->writeEl($xml, $value);
                $xml->endElement();
            } else { //scalar
                $value = $this->writeAttr($xml, $value);
                $xml->writeElement($key, "$value");
            }
        }
    }
protected function writeEl ( XMLWriter $ xml , $ data ) { foreach ( $ data as $ key => $ value ) { if ( \ is_array ( $ value ) && ! $ this -> isAssoc ( $ value ) ) { //numeric array foreach ( $ value as $ itemValue ) { if ( \ is_array ( $ itemValue ) ) { $ xml -> startElement ( $ key ) ; $ itemValue = $ this -> writeAttr ( $ xml , $ itemValue ) ; $ this -> writeEl ( $ xml , $ itemValue ) ; $ xml -> endElement ( ) ; } else { $ itemValue = $ this -> writeAttr ( $ xml , $ itemValue ) ; $ xml -> writeElement ( $ key , "$itemValue" ) ; } } } else if ( \ is_array ( $ value ) ) { //associative array $ xml -> startElement ( $ key ) ; $ value = $ this -> writeAttr ( $ xml , $ value ) ; $ this -> writeEl ( $ xml , $ value ) ; $ xml -> endElement ( ) ; } else { //scalar $ value = $ this -> writeAttr ( $ xml , $ value ) ; $ xml -> writeElement ( $ key , "$value" ) ; } } }
Write XML as per Associative Array

@param      XMLWriter  $xml    object
@param      array      $data   Associative Data Array
Write XML as per Associative Array