public function buildXML(array $data, $startElement = 'data')
    {
        if (!\is_array($data)) {
            $err = 'Invalid variable type supplied, expected array not found on line ' . __LINE__ . ' in Class: ' . __CLASS__ . ' Method: ' . __METHOD__;
            \trigger_error($err);
            return false; //return false error occurred
        }
        $xml = new \XmlWriter();
        $xml->openMemory();
        $xml->startDocument($this->version, $this->encoding);
        $xml->startElement($startElement);

        $data = $this->writeAttr($xml, $data);
        $this->writeEl($xml, $data);

        $xml->endElement(); //write end element
        //returns the XML results
        return $xml->outputMemory(true);
    }
public function buildXML(array $data, $startElement = 'data')
    {
        if (!\is_array($data)) {
            $err = 'Invalid variable type supplied, expected array not found on line ' . __LINE__ . ' in Class: ' . __CLASS__ . ' Method: ' . __METHOD__;
            \trigger_error($err);
            return false; //return false error occurred
        }
        $xml = new \XmlWriter();
        $xml->openMemory();
        $xml->startDocument($this->version, $this->encoding);
        $xml->startElement($startElement);

        $data = $this->writeAttr($xml, $data);
        $this->writeEl($xml, $data);

        $xml->endElement(); //write end element
        //returns the XML results
        return $xml->outputMemory(true);
    }
public function buildXML ( array $ data , $ startElement = 'data' ) { if ( ! \ is_array ( $ data ) ) { $ err = 'Invalid variable type supplied, expected array not found on line ' . __LINE__ . ' in Class: ' . __CLASS__ . ' Method: ' . __METHOD__ ; \ trigger_error ( $ err ) ; return false ; //return false error occurred } $ xml = new \ XmlWriter ( ) ; $ xml -> openMemory ( ) ; $ xml -> startDocument ( $ this -> version , $ this -> encoding ) ; $ xml -> startElement ( $ startElement ) ; $ data = $ this -> writeAttr ( $ xml , $ data ) ; $ this -> writeEl ( $ xml , $ data ) ; $ xml -> endElement ( ) ; //write end element //returns the XML results return $ xml -> outputMemory ( true ) ; }
Build an XML Data Set

@param      array   $data          Associative Array containing values to
be parsed into an XML Data Set(s)
@param      string  $startElement  Root Opening Tag, default data

@return     string  XML String containing values
@return     mixed  Boolean false on failure, string XML result on success
Build an XML Data Set