src/Web/Communicator.php
protected function convertArrayToXml(array $values)
    {
        $dom = new DOMDocument('1.0', 'utf-8');
        $dom->xmlStandalone = true;
        $dom->formatOutput = true;

        try {
            $dom = $this->convertToDom($values, $dom);
            $result = $dom->saveXML();
            if (!$result) {
                throw new RuntimeException('DOMDocument::saveXML failed');
            }
            // Backslashes get lost between here and the Acumulus API, but
            // encoding them makes them get through. Solve here until the
            // real error has been found and solved.
            $result = str_replace('\\', '&#92;', $result);
            return $result;
        } catch (\DOMException $e) {
            // Convert a DOMException to a RuntimeException, so we only have to
            // handle RuntimeExceptions.
            throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
        }
    }
protected function convertArrayToXml(array $values)
    {
        $dom = new DOMDocument('1.0', 'utf-8');
        $dom->xmlStandalone = true;
        $dom->formatOutput = true;

        try {
            $dom = $this->convertToDom($values, $dom);
            $result = $dom->saveXML();
            if (!$result) {
                throw new RuntimeException('DOMDocument::saveXML failed');
            }
            // Backslashes get lost between here and the Acumulus API, but
            // encoding them makes them get through. Solve here until the
            // real error has been found and solved.
            $result = str_replace('\\', '&#92;', $result);
            return $result;
        } catch (\DOMException $e) {
            // Convert a DOMException to a RuntimeException, so we only have to
            // handle RuntimeExceptions.
            throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
        }
    }
protected function convertArrayToXml ( array $ values ) { $ dom = new DOMDocument ( '1.0' , 'utf-8' ) ; $ dom -> xmlStandalone = true ; $ dom -> formatOutput = true ; try { $ dom = $ this -> convertToDom ( $ values , $ dom ) ; $ result = $ dom -> saveXML ( ) ; if ( ! $ result ) { throw new RuntimeException ( 'DOMDocument::saveXML failed' ) ; } // Backslashes get lost between here and the Acumulus API, but // encoding them makes them get through. Solve here until the // real error has been found and solved. $ result = str_replace ( '\\' , '&#92;' , $ result ) ; return $ result ; } catch ( \ DOMException $ e ) { // Convert a DOMException to a RuntimeException, so we only have to // handle RuntimeExceptions. throw new RuntimeException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } }
Converts a keyed, optionally multi-level, array to XML.

Each key is converted to a tag, no attributes are used. Numeric
sub-arrays are repeated using the same key.

@param array $values
The array to convert to XML.

@return string
The XML string

@throws \RuntimeException
Converts a keyed optionally multi - level array to XML .