src/Guzzle/Service/Command/LocationVisitor/Request/XmlVisitor.php
protected function createRootElement(Operation $operation)
    {
        static $defaultRoot = array('name' => 'Request');
        // If no root element was specified, then just wrap the XML in 'Request'
        $root = $operation->getData('xmlRoot') ?: $defaultRoot;
        // Allow the XML declaration to be customized with xmlEncoding
        $encoding = $operation->getData('xmlEncoding');

        $xmlWriter = $this->startDocument($encoding);

        $xmlWriter->startElement($root['name']);
        // Create the wrapping element with no namespaces if no namespaces were present
        if (!empty($root['namespaces'])) {
            // Create the wrapping element with an array of one or more namespaces
            foreach ((array) $root['namespaces'] as $prefix => $uri) {
                $nsLabel = 'xmlns';
                if (!is_numeric($prefix)) {
                    $nsLabel .= ':'.$prefix;
                }
                $xmlWriter->writeAttribute($nsLabel, $uri);
            }
        }
        return $xmlWriter;
    }
protected function createRootElement(Operation $operation)
    {
        static $defaultRoot = array('name' => 'Request');
        // If no root element was specified, then just wrap the XML in 'Request'
        $root = $operation->getData('xmlRoot') ?: $defaultRoot;
        // Allow the XML declaration to be customized with xmlEncoding
        $encoding = $operation->getData('xmlEncoding');

        $xmlWriter = $this->startDocument($encoding);

        $xmlWriter->startElement($root['name']);
        // Create the wrapping element with no namespaces if no namespaces were present
        if (!empty($root['namespaces'])) {
            // Create the wrapping element with an array of one or more namespaces
            foreach ((array) $root['namespaces'] as $prefix => $uri) {
                $nsLabel = 'xmlns';
                if (!is_numeric($prefix)) {
                    $nsLabel .= ':'.$prefix;
                }
                $xmlWriter->writeAttribute($nsLabel, $uri);
            }
        }
        return $xmlWriter;
    }
protected function createRootElement ( Operation $ operation ) { static $ defaultRoot = array ( 'name' => 'Request' ) ; // If no root element was specified, then just wrap the XML in 'Request' $ root = $ operation -> getData ( 'xmlRoot' ) ? : $ defaultRoot ; // Allow the XML declaration to be customized with xmlEncoding $ encoding = $ operation -> getData ( 'xmlEncoding' ) ; $ xmlWriter = $ this -> startDocument ( $ encoding ) ; $ xmlWriter -> startElement ( $ root [ 'name' ] ) ; // Create the wrapping element with no namespaces if no namespaces were present if ( ! empty ( $ root [ 'namespaces' ] ) ) { // Create the wrapping element with an array of one or more namespaces foreach ( ( array ) $ root [ 'namespaces' ] as $ prefix => $ uri ) { $ nsLabel = 'xmlns' ; if ( ! is_numeric ( $ prefix ) ) { $ nsLabel .= ':' . $ prefix ; } $ xmlWriter -> writeAttribute ( $ nsLabel , $ uri ) ; } } return $ xmlWriter ; }
Create the root XML element to use with a request

@param Operation $operation Operation object

@return \XMLWriter
Create the root XML element to use with a request