/**
  * Convert an Array to XML
  * @param string $node_name - name of the root node to be converted
  * @param array $arr - aray to be converterd
  * @return DomDocument
  */
 public static function &createXML($node_name, $arr = array())
 {
     $xml = self::getXMLRoot();
     $xml->appendChild(self::convert($node_name, $arr));
     self::$xml = null;
     // clear the xml node in the class for 2nd time use.
     return $xml;
 }
 private function _toXML()
 {
     $xml = Lema21_Nfe_Model_Lib_Array2XML::createXML('pedido', $this->_xml);
     $this->_stringFinalXML = $xml->saveXML();
     return $this;
 }