void
  operator <<= (Miro::SensorGroupIDL& group, const QDomNode& node)
  {
    if (!node.isNull()) {

      // set sensor defaults
      Miro::SensorPositionIDL sensor;
      sensor.masked = false;
      QDomNamedNodeMap map = node.attributes();
      QDomNode n;
      n = map.namedItem("height");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.height = attr.value().toInt();
      }
      n = map.namedItem("distance");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.distance =attr.value().toInt();
      }
      n = map.namedItem("alpha");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.alpha = deg2Rad(attr.value().toDouble());
      }
      n = map.namedItem("beta");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.beta = deg2Rad(attr.value().toDouble());
      }
      n = map.namedItem("gamma");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.gamma = deg2Rad(attr.value().toDouble());
      }
      QDomNode n1 = node.firstChild();
      while(!n1.isNull() ) {
	if (n1.nodeName() == "description") {
	  group.description <<= n1;
	}
	else if (n1.nodeName() == "sensor") {
	  group.sensor.length(group.sensor.length() + 1);
	  group.sensor[group.sensor.length() - 1] = sensor;
	  group.sensor[group.sensor.length() - 1] <<= n1;
	}
	n1 = n1.nextSibling();
      }
    }
  }
示例#2
0
void XMLParser::parseNode(IEntity *entity,QDomNode *node)
{
    while(!node->isNull())
    {
        QString namesp;
        QString name;
        IEntity *auxent = NULL;
        QDomElement child = node->toElement();
        if(!child.isNull())
        {
#ifdef PARSER_DEBUG
            qDebug() << child.tagName();
#endif
            splitNode(child.tagName(),namesp,name);
            if(name.isEmpty())
                throw new XMLParserException("Unable to parse node\n");
            auxent = new IEntity(namesp,name);
        }
        if(node->hasAttributes())
        {
            QDomNamedNodeMap attributes = node->attributes();
            for(unsigned int i=0; i<=attributes.length(); i++)
            {
                QDomNode n = attributes.item(i);
                if(n.isAttr())
                {
#ifdef PARSER_DEBUG
                    qDebug() << n.toAttr().name()<< "=" << n.toAttr().value();
#endif
                    QString attnamesp;
                    QString attname;
                    splitNode(n.toAttr().name(),attnamesp,attname);
                    //TODO: add attribute with namespace
                    auxent->addAttribute(attname,n.toAttr().value());
                }
            }
        }
        if(node->isText())
        {
#ifdef PARSER_DEBUG
            qDebug() << node->toText().data();
#endif
            entity->addValue(node->toText().data());
        } else
            entity->addEntity(auxent);
        if (node->hasChildNodes())
            parseNode(auxent,&node->firstChild());
        node = &(node->nextSibling());
    }
}
示例#3
0
void SvgImage::modify(const QString &tag, const QString &id, const QString &attribute,
                      const QString &value)
{
    bool modified = false;

    QDomNodeList nodeList = m_svgDocument.elementsByTagName( tag );
    for ( int i = 0; i < nodeList.count(); ++i )
    {
        QDomNode node = nodeList.at( i );
        QDomNamedNodeMap attributes = node.attributes();
        if ( checkIDAttribute( attributes, id ) )
        {
            QDomNode attrElement = attributes.namedItem( attribute );
            if ( attrElement.isAttr() )
            {
                QDomAttr attr = attrElement.toAttr();
                attr.setValue( value );
                modified = true;
            }
        }
    }

    if ( modified )
    {
        m_updateNeeded = true;
        update();
    }
}
示例#4
0
QDomAttr QDomNodeProto:: toAttr() const
{
  QDomNode *item = qscriptvalue_cast<QDomNode*>(thisObject());
  if (item)
    return item->toAttr();
  return QDomAttr();
}
示例#5
0
/** Returns wether the Report Section must be drawed or not depending on the DrawIf attribute and the current record values */
bool MReportSection::mustBeDrawed( QDomNode * record ) {
  QString value;
  QDomNamedNodeMap fields = record->attributes();
  QString drawIfField = getDrawIf();

  if ( !drawIfField.isEmpty() ) {
    QDomNode n = fields.namedItem( drawIfField );

    if ( n.isNull() )
      return false;

    value = n.toAttr().value();

    if ( value.isEmpty() )
      return false;

    bool b = true;

    float f = value.toFloat( &b );

    if ( f == 0 && b )
      return false;
  }

  return true;
}
示例#6
0
bool checkIDAttribute( const QDomNamedNodeMap& map, const QString& value )
{
    QDomNode attrElement = map.namedItem( "id" );
    if ( attrElement.isAttr() )
    {
        QDomAttr attr = attrElement.toAttr();
        return attr.value() == value;
    }
    return false;
}
示例#7
0
/**
 * @brief XmlEditWidgetPrivate::findDomNodeScan find the nearest match to a position
 * @param node
 * @param nodeTarget
 * @param lineSearched
 * @param columnSearched
 * @param lastKnownNode: last known "good" position
 * @return
 */
bool XmlEditWidgetPrivate::findDomNodeScan(QDomNode node, QDomNode nodeTarget, const int lineSearched, const int columnSearched, FindNodeWithLocationInfo &info)
{
    int row = node.lineNumber();
    int col = node.columnNumber();
    if(!node.isDocument()) {
        if((lineSearched == row) && (columnSearched == col)) {
            info.matchedNode = nodeTarget ;
            return true ;
        }

        if((lineSearched == row) && (columnSearched == col)) {
            info.matchedNode = nodeTarget ;
            return true ;
        }
        if((lineSearched == row) && (columnSearched < col)) {
            info.matchedNode = nodeTarget ;
            return true ;
        }
        if((lineSearched < row)) {
            info.matchedNode = nodeTarget ;
            return true ;
        }
        if((lineSearched <= row)) {
            info.lastKnownNode = nodeTarget ;
        }

        if(node.nodeType() == QDomNode::ElementNode) {
            QDomElement element = node.toElement();
            QDomNamedNodeMap attributes = element.attributes();
            int numAttrs = attributes.length();
            for(int i = 0 ; i < numAttrs ; i++) {
                QDomNode node = attributes.item(i);
                QDomAttr attr = node.toAttr();
                if(findDomNodeScan(attr, nodeTarget, lineSearched, columnSearched, info)) {
                    return true;
                }
            } // for
        }
    }

    int nodes = node.childNodes().count();
    for(int i = 0 ; i < nodes ; i ++) {
        QDomNode childNode = node.childNodes().item(i) ;
        if(childNode.isText() || childNode.isCDATASection()) {
            if(findDomNodeScan(childNode, nodeTarget, lineSearched, columnSearched, info)) {
                return true;
            }
        } else {
            if(findDomNodeScan(childNode, childNode, lineSearched, columnSearched, info)) {
                return true ;
            }
        }
    }
    return false ;
}
void ItemDefinitionGroup::processNodeAttributes(const QDomElement &nodeElement)
{
    // process attributes
    QDomNamedNodeMap namedNodeMap = nodeElement.attributes();
    QDomNode domNode = namedNodeMap.item(0);

    if (domNode.nodeType() == QDomNode::AttributeNode) {
        QDomAttr domElement = domNode.toAttr();

        if (domElement.name() == QLatin1String("Condition"))
            m_condition = domElement.value();
    }
}
示例#9
0
void DebuggerTool::processNodeAttributes(const QDomElement &element)
{
    QDomNamedNodeMap namedNodeMap = element.attributes();

    for (int i = 0; i < namedNodeMap.size(); ++i) {
        QDomNode domNode = namedNodeMap.item(i);

        if (domNode.nodeType() == QDomNode::AttributeNode) {
            QDomAttr domElement = domNode.toAttr();
            m_anyAttribute.insert(domElement.name(), domElement.value());
//            vc_dbg << "Any AttributeNode: name: " << domElement.name() << " value: " << domElement.value();
        }
    }
}
示例#10
0
void OnError::processNodeAttributes(const QDomElement &nodeElement)
{
    // process attributes
    QDomNamedNodeMap namedNodeMap = nodeElement.attributes();
    QDomNode domNode = namedNodeMap.item(0);

    if (domNode.nodeType() == QDomNode::AttributeNode) {
        QDomAttr domElement = domNode.toAttr();

        if (domElement.name() == QLatin1String("Condition"))
            m_condition = domElement.value();
        else if (domElement.name() == QLatin1String("ExecuteTargets"))
            m_executeTargets = domElement.value().split(QLatin1Char(';'));
    }
}
示例#11
0
void Platform::processNodeAttributes(const QDomElement &element)
{
    QDomNamedNodeMap namedNodeMap = element.attributes();

    if (namedNodeMap.size() == 1) {
        QDomNode domNode = namedNodeMap.item(0);

        if (domNode.nodeType() == QDomNode::AttributeNode) {
            QDomAttr domElement = domNode.toAttr();

            if (domElement.name() == QString("Name")) {
                m_name = domElement.value();
//                vc_dbg << "AttributeNode: name: " << domElement.name() << " value: " << domElement.value();
            }
        }
    }
}
示例#12
0
void ComplexBaseInputField::setXMLData( const QDomElement &element )
{
  if ( mName != element.tagName() ) {
    qDebug( "ComplexBaseInputField: Wrong dom element passed: expected %s, got %s", qPrintable( mName ), qPrintable( element.tagName() ) );
    return;
  }

  // elements
  if ( mType->isArray() ) {
    InputField *field = childField( "item" );
    field->setXMLData( element );
  } else {
    QDomNode node = element.firstChild();
    while ( !node.isNull() ) {
      QDomElement child = node.toElement();
      if ( !child.isNull() ) {
        InputField *field = childField( child.tagName() );
        if ( !field ) {
          qDebug( "ComplexBaseInputField: Child field %s does not exists", qPrintable( child.tagName() ) );
        } else {
          field->setXMLData( child );
        }
      }

      node = node.nextSibling();
    }
  }

  // attributes
  QDomNamedNodeMap nodes = element.attributes();
  for ( int i = 0; i < nodes.count(); ++i ) {
    QDomNode node = nodes.item( i );
    QDomAttr attr = node.toAttr();

    InputField *field = childField( attr.name() );
    if ( !field ) {
      qDebug( "ComplexBaseInputField: Child field %s does not exists", qPrintable( attr.name() ) );
    } else {
      field->setData( attr.value() );
    }
  }
}
示例#13
0
void Project::processNodeAttributes(const QDomElement &nodeElement)
{
    // process attributes
    QDomNamedNodeMap namedNodeMap = nodeElement.attributes();

    for (int i = 0; i < namedNodeMap.size(); ++i) {
        QDomNode domNode = namedNodeMap.item(i);

        if (domNode.nodeType() == QDomNode::AttributeNode) {
            QDomAttr domElement = domNode.toAttr();

            if (domElement.name() == QLatin1String("DefaultTargets"))
                m_defaultTargets = domElement.value().split(QLatin1Char(';'));
            else if (domElement.name() == QLatin1String("InitialTargets"))
                m_initialTargets = domElement.value().split(QLatin1Char(';'));
            else if (domElement.name() == QLatin1String("ToolsVersion"))
                m_toolsVersion = domElement.value();
            else if (domElement.name() == QLatin1String("xmlns"))
                m_xmlns = domElement.value();
        }
    }
}
示例#14
0
void Item::processAttributes(const QDomElement &nodeElement)
{
    // process attributes
    QDomNamedNodeMap namedNodeMap = nodeElement.attributes();

    for (int i = 0; i < namedNodeMap.size(); ++i) {
        QDomNode domNode = namedNodeMap.item(i);

        if (domNode.nodeType() == QDomNode::AttributeNode) {
            QDomAttr domElement = domNode.toAttr();

            if (domElement.name() == QLatin1String("Condition"))
                m_condition = domElement.value();
            else if (domElement.name() == QLatin1String("Include"))
                m_include = domElement.value();
            else if (domElement.name() == QLatin1String("Exclude"))
                m_exclude = domElement.value();
            else if (domElement.name() == QLatin1String("Remove"))
                m_remove = domElement.value();
        }
    }

    m_name = nodeElement.nodeName();
}
示例#15
0
void configManager::loadConfigFile()
{
	// read the XML file and create DOM tree
	QFile cfg_file( m_lmmsRcFile );
	QDomDocument dom_tree;

	if( cfg_file.open( QIODevice::ReadOnly ) )
	{
		QString errorString;
		int errorLine, errorCol;
		if( dom_tree.setContent( &cfg_file, false, &errorString, &errorLine, &errorCol ) )
		{
			// get the head information from the DOM
			QDomElement root = dom_tree.documentElement();

			QDomNode node = root.firstChild();

			// create the settings-map out of the DOM
			while( !node.isNull() )
			{
				if( node.isElement() &&
					node.toElement().hasAttributes () )
				{
					stringPairVector attr;
					QDomNamedNodeMap node_attr =
						node.toElement().attributes();
					for( int i = 0; i < node_attr.count();
									++i )
					{
		QDomNode n = node_attr.item( i );
		if( n.isAttr() )
		{
			attr.push_back( qMakePair( n.toAttr().name(),
							n.toAttr().value() ) );
		}
					}
					m_settings[node.nodeName()] = attr;
				}
				else if( node.nodeName() == "recentfiles" )
				{
					m_recentlyOpenedProjects.clear();
					QDomNode n = node.firstChild();
					while( !n.isNull() )
					{
		if( n.isElement() && n.toElement().hasAttributes() )
		{
			m_recentlyOpenedProjects <<
					n.toElement().attribute( "path" );
		}
		n = n.nextSibling();
					}
				}
				node = node.nextSibling();
			}

			if( value( "paths", "artwork" ) != "" )
			{
				m_artworkDir = value( "paths", "artwork" );
				if( !QDir( m_artworkDir ).exists() )
				{
					m_artworkDir = defaultArtworkDir();
				}
				if( m_artworkDir.right( 1 ) !=
							QDir::separator() )
				{
					m_artworkDir += QDir::separator();
				}
			}
			setWorkingDir( value( "paths", "workingdir" ) );
			setVSTDir( value( "paths", "vstdir" ) );
			setFLDir( value( "paths", "fldir" ) );
			setLADSPADir( value( "paths", "laddir" ) );
		#ifdef LMMS_HAVE_STK
			setSTKDir( value( "paths", "stkdir" ) );
		#endif
		#ifdef LMMS_HAVE_FLUIDSYNTH
			setDefaultSoundfont( value( "paths", "defaultsf2" ) );
		#endif
			setBackgroundArtwork( value( "paths", "backgroundartwork" ) );
		}
		else
		{
			QMessageBox::warning( NULL, MainWindow::tr( "Configuration file" ),
									MainWindow::tr( "Error while parsing configuration file at line %1:%2: %3" ).
													arg( errorLine ).
													arg( errorCol ).
													arg( errorString ) );
		}
		cfg_file.close();
	}


	if( m_vstDir.isEmpty() || m_vstDir == QDir::separator() ||
			!QDir( m_vstDir ).exists() )
	{
#ifdef LMMS_BUILD_WIN32
		m_vstDir = windowsConfigPath( CSIDL_PROGRAM_FILES ) +
											QDir::separator() + "VstPlugins";
#else
		m_vstDir = ensureTrailingSlash( QDir::home().absolutePath() );
#endif
	}

	if( m_flDir.isEmpty() || m_flDir == QDir::separator() )
	{
		m_flDir = ensureTrailingSlash( QDir::home().absolutePath() );
	}

	if( m_ladDir.isEmpty() || m_ladDir == QDir::separator() ||
			( !m_ladDir.contains( ':' ) && !QDir( m_ladDir ).exists() ) )
	{
#if defined(LMMS_BUILD_WIN32)
		m_ladDir = m_pluginDir + "ladspa" + QDir::separator();
#elif defined(LMMS_BUILD_APPLE)
		m_ladDir = qApp->applicationDirPath() + "/../lib/lmms/ladspa/";
#else
		m_ladDir = qApp->applicationDirPath() + '/' + LIB_DIR + "/ladspa/";
#endif
	}

#ifdef LMMS_HAVE_STK
	if( m_stkDir.isEmpty() || m_stkDir == QDir::separator() ||
			!QDir( m_stkDir ).exists() )
	{
#if defined(LMMS_BUILD_WIN32)
		m_stkDir = m_dataDir + "stk/rawwaves/";
#elif defined(LMMS_BUILD_APPLE)
		m_stkDir = qApp->applicationDirPath() + "/../share/stk/rawwaves/";
#else
		m_stkDir = "/usr/share/stk/rawwaves/";
#endif
	}
#endif


	QDir::setSearchPaths( "resources", QStringList() << artworkDir()
						<< defaultArtworkDir() );

	if( !QDir( m_workingDir ).exists() )
	{
		if( QMessageBox::question( 0,
			MainWindow::tr( "Working directory" ),
			MainWindow::tr( "The LMMS working directory %1 does not "
				"exist. Create it now? You can change the directory "
				"later via Edit -> Settings." ).arg( m_workingDir ),
					QMessageBox::Yes, QMessageBox::No ) ==
								QMessageBox::Yes )
		{
			QDir().mkpath( m_workingDir );
		}
	}
	if( QDir( m_workingDir ).exists() )
	{
		QDir().mkpath( userProjectsDir() );
		QDir().mkpath( userSamplesDir() );
		QDir().mkpath( userPresetsDir() );
	}
}
示例#16
0
SBGNGlyph::SBGNGlyph(QDomNode node) :
    m_shape(NULL), m_orient(HORIZ)
{
    QDomNamedNodeMap attrs = node.attributes();
    m_id = attrs.namedItem("id").toAttr().value();
    m_class = attrs.namedItem("class").toAttr().value();

    // Get orientation, if defined.
    QDomNode orient = attrs.namedItem("orientation");
    if (!orient.isNull())
    {
        QString ostr = orient.toAttr().value();
        if (ostr == "vertical")
        {
            m_orient = VERT;
        }
        else if (ostr == "horizontal")
        {
            m_orient = HORIZ;
        }
    }

    // Get any ports that may be defined.
    QDomNode port = node.namedItem("port");
    while (!port.isNull()) {
        addPort(port);
        port = port.nextSiblingElement("port");
    }

    // Label
    QDomNode label = node.namedItem("label");
    if (!label.isNull()) {
        QDomNamedNodeMap labelAttrs = label.attributes();
        m_labelText = labelAttrs.namedItem("text").toAttr().value();
        // Get bbox of label, if it is specified.
        if (label.hasChildNodes())
        {
            QDomNode labelBboxNode = label.namedItem("bbox");
            if (!labelBboxNode.isNull())
            {
                QDomNamedNodeMap lbboxAttrs = labelBboxNode.attributes();
                float x = lbboxAttrs.namedItem("x").toAttr().value().toFloat();
                float y = lbboxAttrs.namedItem("y").toAttr().value().toFloat();
                float w = lbboxAttrs.namedItem("w").toAttr().value().toFloat();
                float h = lbboxAttrs.namedItem("h").toAttr().value().toFloat();
                m_labelBbox = QRectF(x,y,w,h);
            }
        }
    }

    // Is it marked as a clone?
    QDomNode cloneMarker = node.namedItem("clone");
    m_isCloned = !cloneMarker.isNull();

    // Bbox of node
    QDomNode bbox = node.namedItem("bbox");
    QDomNamedNodeMap bboxAttrs = bbox.attributes();
    float x = bboxAttrs.namedItem("x").toAttr().value().toFloat();
    float y = bboxAttrs.namedItem("y").toAttr().value().toFloat();
    float w = bboxAttrs.namedItem("w").toAttr().value().toFloat();
    float h = bboxAttrs.namedItem("h").toAttr().value().toFloat();
    m_Bbox = QRectF(x,y,w,h);

    // Make the shape.
    makeShape();
}
示例#17
0
//Encargado de generar un nuevo archivo de registros a partir de un archivo XML
void MainWindow::on_importXML_triggered()
{
    //Se obtiene la direccion del archivo xml
    QString file = QFileDialog::getOpenFileName(this,"Importar archivo XML","","XML (*.xml)");

    //verifica que la direccion este bien
    if(!file.isEmpty()){

        //si esta abierto un archivo de registros entonces lo cierra y muestra al usuario
        //a que escoga el lugar de destino del nuevo archivo que se escribe

        //verifica que los archivos este cerrados
        if(this->fileRecord.isOpen()){
            this->fileRecord.close();
        }
        if(this->indicesFile.isOpen()){
            this->indicesFile.close();
        }

        //Limpia el vector de campos del archivo
        while(this->fileRecord.fieldsSize() != 0){
            this->fileRecord.removeField(0);
        }

        //toma la direccion del nuevo archivo de registros
        QString directory = QFileDialog::getExistingDirectory(this,"New File","");
        if(!directory.isEmpty()){
            bool val;
            //Pregunta el nombre del archivo destino
            QString fileName = QInputDialog::getText(this,"Nombre del Archivo","Escriba el nombre del archivo que desea crear",QLineEdit::Normal,"",&val);
            if(val && !fileName.isEmpty()){
                QString Path = directory + "/" + fileName + ".jjdb";
                //escribe algo, luego lo cierra y vuelve a abrir
                if(!this->fileRecord.open(Path.toStdString())){
                    this->fileRecord.open(Path.toStdString(),ios_base::out);
                    this->fileRecord.write("$$",2);
                    this->fileRecord.flush();
                    this->fileRecord.close();

                    QString indicesPath = directory + "/" + fileName + "-indices.jjdb";
                    this->indicesFile.open(indicesPath.toStdString().c_str(),ios_base::out);
                    this->indicesFile.write("$$",2);
                    this->indicesFile.flush();
                    this->indicesFile.close();

                    this->indicesFile.open(indicesPath.toStdString().c_str(),ios_base::in | ios_base::out);

                    if(this->fileRecord.open(Path.toStdString(),ios_base::in | ios_base::out)){

                        //se hace del uso de un QDomDocument que permite la lectura del xml
                        QDomDocument document;

                        //uso de un qfile
                        QFile qfile(file);

                        //verifica que archivo este abierto solamente en modo de lectura
                        if(!qfile.open(QIODevice::ReadOnly)){
                            QMessageBox::critical(this,"Error","Hubo un error en la lectura del archivo XML");
                            return;
                        }

                        //le asigna el contenido del archivo al documento que permite la lectura
                        if(!document.setContent(&qfile)){
                            QMessageBox::critical(this,"Error","Hubo un error de lectura del archivo XML");
                            return;
                        }

                        //Esta lectura se basa especificamente en tomar los elementos y crear registros
                        //a partir de ellos
                        QDomElement db = document.documentElement();

                        QDomNode fr = db.firstChild().firstChild();

                        QDomElement elem = fr.toElement();

                        //verifica que los elementos no sean nulos
                        while(!elem.isNull()){
                                QString name = elem.tagName();

                                if(!elem.hasAttributes()){
                                    QMessageBox::critical(this,"Error","El archivo XML contiene una mala estructura");
                                    return;
                                }

                                QDomNamedNodeMap map = elem.attributes();

                                char type;
                                int length;
                                int decimalPlaces = 0;
                                int key = 0;

                                if(map.size() < 3){
                                    QMessageBox::critical(this,"Error","El archivo XML contiene una mala estructura");
                                    return;
                                }

                                //toma de los elementos xml y los convierte a las caracteristicas de un registro
                                for(int i = 0; i < map.size(); i++){
                                    if(!map.item(i).isNull()){
                                        QDomNode node = map.item(i);
                                        QDomAttr attr = node.toAttr();

                                        if(attr.name() == "key"){
                                            if(attr.value() == "true"){
                                                key = 1;
                                            }
                                        }else if(attr.name() == "type"){
                                            if(attr.value() == "integer"){
                                                type = 'E';
                                            }else if(attr.value() == "real"){
                                                type = 'R';
                                            }else{
                                                type = 'C';
                                            }
                                        }else if(attr.name() == "length"){
                                            length = attr.value().toInt();
                                        }else if(attr.name() == "decimalPlaces"){
                                            decimalPlaces = attr.value().toInt();
                                        }else{
                                            QMessageBox::critical(this,"Error","El archivo XML tiene una mala estructura");
                                            return;
                                        }
                                    }else{
                                        QMessageBox::critical(this,"Error","Mala estructura del archivo XML");
                                        return;
                                    }
                                }

                                //creacion de un nuevo registro
                                Field* newField = new Field(name.toStdString(),type,key,length,decimalPlaces);
                                this->fileRecord.addField(newField);
                                elem = elem.nextSibling().toElement();
                        }

                        //cambia el tamanio de los registros del archivo
                        int rl = 0;
                        vector<Field*> fields = this->fileRecord.getFields();
                        for(int i = 0; i < fields.size(); i++){
                            rl += fields.at(i)->getLength();
                        }
                        this->fileRecord.setRecordLength(rl);

                        //limpia el mapa de indices primarios
                        this->fileRecord.cleanMap();

                        //se encarga de hacer el header del archivo y guardar los campos
                        string header = this->fileRecord.toStringHeader();
                        this->fileRecord.write(header.c_str(),header.size());
                        this->fileRecord.flush();

                        QDomElement start_data = db.firstChild().toElement();

                        //se encarga especificamente de tomar los datos del xml
                        //y los convierte en los registros
                        while(!start_data.isNull()){
                            vector<string> record;

                            QDomElement e = start_data.firstChild().toElement();
                            while(!e.isNull()){
                                record.push_back(e.text().trimmed().toStdString());
                                e = e.nextSibling().toElement();
                            }

                            //creacion de un nuevo registro
                            Record* r  = new Record(this->fileRecord.getFields(),record);
                            this->fileRecord.addRecord(r);


                            start_data = start_data.nextSibling().toElement();
                        }

                        //ahora se encarga de hacer los indices y de guardarlos en el archivo de indices
                        vector<PrimaryIndex*> indexes = this->fileRecord.getIndexes();

                        stringstream ss;
                        for(int i = 0; i < indexes.size(); i++){
                            ss<<indexes.at(i)->toString();
                            if(i != indexes.size() -1){
                                ss<<'/';
                            }
                        }
                        this->indicesFile.seekp(0,ios_base::beg);
                        this->indicesFile.write(ss.str().c_str(),ss.str().length());
                        this->indicesFile.flush();

                        //solamente cierra el archivo xml
                        qfile.close();

                        QMessageBox::information(this,"Satisfactorio","Se ha creado el archivo de registros correctamente");

                    }else{
                        QMessageBox::critical(this,"Error","Hubo un error inesperado al momento de abrir el archivo creado");
                    }
                }else{
                    QMessageBox::critical(this,"Error","Hubo un error al momento de abrir el archivo para su inicializacion");
                }
            }
        }

    }
}