protected function xmlSerialize($data, $xml = null)
    {
        if ( !$xml instanceof SimpleXMLElement )
        {
            $xml = new SimpleXMLElement('<'. $this->requestName .' xmlns="'. $this->namespace .'" />');
        }

        foreach ($data as $key => $value)
        {
            if ( !isset($value) )
            {
                continue;
            }

            if ( is_array($value) )
            {
                $node = $xml->addChild($key);
                $this->xmlSerialize($value, $node);
            }
            else
            {
                $xml->addChild($key, $value);
            }
        }

        return $xml->asXML();
    }
protected function xmlSerialize($data, $xml = null)
    {
        if ( !$xml instanceof SimpleXMLElement )
        {
            $xml = new SimpleXMLElement('<'. $this->requestName .' xmlns="'. $this->namespace .'" />');
        }

        foreach ($data as $key => $value)
        {
            if ( !isset($value) )
            {
                continue;
            }

            if ( is_array($value) )
            {
                $node = $xml->addChild($key);
                $this->xmlSerialize($value, $node);
            }
            else
            {
                $xml->addChild($key, $value);
            }
        }

        return $xml->asXML();
    }
protected function xmlSerialize ( $ data , $ xml = null ) { if ( ! $ xml instanceof SimpleXMLElement ) { $ xml = new SimpleXMLElement ( '<' . $ this -> requestName . ' xmlns="' . $ this -> namespace . '" />' ) ; } foreach ( $ data as $ key => $ value ) { if ( ! isset ( $ value ) ) { continue ; } if ( is_array ( $ value ) ) { $ node = $ xml -> addChild ( $ key ) ; $ this -> xmlSerialize ( $ value , $ node ) ; } else { $ xml -> addChild ( $ key , $ value ) ; } } return $ xml -> asXML ( ) ; }
Serializes an array into XML

@param array $data Array to serialize into XML.
@param \SimpleXMLElement $xml SimpleXMLElement object.

@return string XML
Serializes an array into XML