protected function generar_tabla($path, $nombre_tabla, &$tabla)
 {
     $xml = new toba_xml($path);
     $xml->abrir_elemento(toba_pers_xml_elementos::tabla);
     $xml->add_atributo(toba_pers_xml_atributos::id, $nombre_tabla, true);
     // el contenido es el array con metadata de estado, clave y data
     foreach (array_keys($tabla) as $key_contenido) {
         $estado = $tabla[$key_contenido]['estado'];
         $xml->abrir_elemento(toba_pers_xml_elementos::registro);
         $xml->add_atributo(toba_pers_xml_atributos::estado, $estado, true);
         if ($this->grabo_clave($estado)) {
             $xml->add_atributo(toba_pers_xml_atributos::clave, $tabla[$key_contenido]['clave'], true);
         }
         foreach (array_eliminar_nulls($tabla[$key_contenido]['data']) as $columna => $valor) {
             $xml->abrir_elemento(toba_pers_xml_elementos::columna);
             $xml->add_atributo(toba_pers_xml_atributos::nombre, $columna, true);
             if ($estado == toba_personalizacion::registro_updated) {
                 $xml->add_atributo(toba_pers_xml_atributos::valor, $valor['actual'], true);
                 $xml->add_atributo(toba_pers_xml_atributos::valor_original, $valor['original'], true);
             } else {
                 // es un registro nuevo
                 $xml->add_atributo(toba_pers_xml_atributos::valor, $valor, true);
             }
             $xml->cerrar_elemento();
         }
         $xml->cerrar_elemento();
     }
     $xml->cerrar_elemento();
     $xml->cerrar_documento();
 }
 private function generar_componente_nueva(&$componente, $path)
 {
     toba_manejador_archivos::crear_arbol_directorios(dirname($path));
     //Creo el directorio si aun no existe
     $xml = new toba_xml($path);
     $xml->abrir_elemento(toba_pers_xml_elementos::componente);
     $xml->add_atributo(toba_pers_xml_atributos::id, $componente['id']['componente'], true);
     $xml->add_atributo(toba_pers_xml_atributos::descripcion, $componente['tipo'], true);
     foreach ($componente['metadata'] as $key_tabla => $contenido) {
         if (empty($contenido)) {
             continue;
         }
         $xml->abrir_elemento(toba_pers_xml_elementos::tabla);
         $xml->add_atributo(toba_pers_xml_atributos::nombre, $key_tabla, true);
         foreach ($contenido as $registro) {
             $xml->abrir_elemento(toba_pers_xml_elementos::registro);
             foreach (array_eliminar_nulls($registro) as $columna => $valor) {
                 $xml->abrir_elemento(toba_pers_xml_elementos::columna);
                 $xml->add_atributo(toba_pers_xml_atributos::nombre, $columna, true);
                 $xml->add_atributo(toba_pers_xml_atributos::valor, $valor, true);
                 $xml->cerrar_elemento();
             }
             $xml->cerrar_elemento();
         }
         $xml->cerrar_elemento();
     }
     $xml->cerrar_elemento();
     $xml->cerrar_documento();
 }