 if(!xmlFile.exists())
  {
    cout<<"File does not exist."<<endl;

    //Kodierung auf UTF-16 stellen 
    tsXML.setGenerateByteOrderMark(true);
    tsXML.setAutoDetectUnicode(false);
    tsXML.setCodec(QTextCodec::codecForName("utf16"));

    //erstellt Header in XML-Datei
    QDomProcessingInstruction headerXML = docXML.createProcessingInstruction( "xml","version=\"1.0\" encoding=\"UTF-16\"");
    docXML.appendChild(headerXML);

    QDomElement deRoot = docXML.createElement("data");
    docXML.appendChild(deRoot);

    add_globalSets(docXML);

    add_localSets(docXML);

     //neue Datei anlegen
    cout<<"Creating new file "<<qPrintable(xmlFile.fileName())<<endl;
    createNewFile(xmlFile);

    cout<<"Writing XML-Data in the new created file."<<endl;

    tsXML << docXML.toString();

    tsXML.flush();
    xmlFile.close();
  }
  if(1)
  {
    //XML-Datei oeffnen
    if(!xmlFile.open(QIODevice::ReadWrite|QIODevice::Text))
    {
      cout<<"Could not open the file "<<qPrintable(xmlFile.fileName())<<"."<<endl;
      return -3;
    }
    else
    {
      //XML-Datei lesen
      QByteArray XMLfileContent = xmlFile.readAll();
      QString sXMLfileContent((const QByteArray&)XMLfileContent);

      //XML-Datei parsen
      if(!docXML.setContent(sXMLfileContent,&errorMessage,&line,&column))
      {
        cout<<"\nIn XML-File: "<<qPrintable(xmlFile.fileName())<<endl;
        cout<<"Error in Line: " << line << ", Column: " << column << ":" << qPrintable(errorMessage)<<endl;
        xmlFile.close();
        return 1;
      }
      else
      {
        //Hier werden noch weitere Tags mit Inhalt in die Datei geschrieben. 
        //Die Datei wird am Ende ordunungsgemäß geschlossen, sofern vorher kein
        //Fehler beim Parsen auftritt.
      }