// 将销售记录写入文档
void Widget::writeXml()
{
    // 先从文件读取
    if (docRead()) {
            QString currentDate = getDateTime(Date);
            QDomElement root = doc.documentElement();
            // 根据是否有日期节点进行处理
            if (!root.hasChildNodes()) {
                    QDomElement date = doc.createElement(QString("日期"));
                    QDomAttr curDate = doc.createAttribute("date");
                    curDate.setValue(currentDate);
                    date.setAttributeNode(curDate);
                    root.appendChild(date);
                    createNodes(date);
            } else {
                    QDomElement date = root.lastChild().toElement();
                    // 根据是否已经有今天的日期节点进行处理
                    if (date.attribute("date") == currentDate) {
                            createNodes(date);
                    } else {
                            QDomElement date = doc.createElement(QString("日期"));
                            QDomAttr curDate = doc.createAttribute("date");
                            curDate.setValue(currentDate);
                            date.setAttributeNode(curDate);
                            root.appendChild(date);
                            createNodes(date);
                    }
            }
            // 写入到文件
            docWrite();
    }
}
Example #2
0
void Properties::save(QDomDocument &doc, QDomElement &parent)
{               
  QDomElement propertiesElem = doc.createElement(XML_TAGNAME.c_str());
  parent.appendChild(propertiesElem);

  QDomAttr propertieAttr;
  for (std::map<std::string, Property*>::iterator it = _properties.begin(); it != _properties.end(); ++it)
  {    
    // to save string lists, we save each value the format property_name[index]
    const std::vector<std::string> &lst = it->second->valueStrList();
    if(lst.size()>1)
    {
      
      for(unsigned int i=0;i<lst.size(); i++)
      {
        QString index;
        index.sprintf("%i",i);
        propertieAttr = doc.createAttribute(QString(it->second->name().c_str()).replace(' ', WHITESPACE_REPLACEMENT)+index);
        propertieAttr.setValue(lst[i].c_str());
        propertiesElem.setAttributeNode(propertieAttr);
      }
    }
    else
    {
      propertieAttr = doc.createAttribute(QString(it->second->name().c_str()).replace(' ', WHITESPACE_REPLACEMENT));
      propertieAttr.setValue(it->second->valueStr().c_str());
      propertiesElem.setAttributeNode(propertieAttr);
    }
  }    
}
Example #3
0
void Gear_ListBox::internalSave(QDomDocument &doc, QDomElement &gearElem)
{
  std::ostringstream strValue;

  strValue << getValue();
  QDomAttr attrListBoxPos = doc.createAttribute("ListBoxPos");
  attrListBoxPos.setValue(strValue.str().c_str());
  gearElem.setAttributeNode(attrListBoxPos);

}
Example #4
0
void Schema::Connection::save(QDomDocument &doc, QDomElement &parent)
{
  QDomElement connectionElem = doc.createElement("Connection");
  parent.appendChild(connectionElem);

  QDomAttr gearA = doc.createAttribute("GearA");
  gearA.setValue(_gearA.c_str());
  connectionElem.setAttributeNode(gearA);

  QDomAttr input = doc.createAttribute("Input");
  input.setValue(_input.c_str());
  connectionElem.setAttributeNode(input);

  QDomAttr gearB = doc.createAttribute("GearB");
  gearB.setValue(_gearB.c_str());
  connectionElem.setAttributeNode(gearB);

  QDomAttr output = doc.createAttribute("Output");
  output.setValue(_output.c_str());
  connectionElem.setAttributeNode(output);

}
Example #5
0
void MainWindow::on_btn_select_clicked()
{
    ui->listWidget->clear();
    ui->listWidget->addItem(tr("无法添加"));
    QFile file("my.xml");
    if(!file.open(QIODevice::ReadOnly()))
    {
        return;
    }
    QDomDocument doc;
    if(!doc.setContent(&file))
    {
        file.close();
        return ;
    }
    file.close();

    QDomElement root = doc.documentElement();
    QDomElement book = doc.documentElement(tr("图书"));
    QDomAttr id = doc.createAttribute(tr("编号"));
    QDomElement title = doc.documentElement(tr("书名"));
    QDomElement author = doc.documentElement(tr("作者"));
    QDomText text;

    QString num = root.lastChild().toElement().attribute(tr("编号"));
    int count = num.toInt() +1;
    id.setValue(QString::number(count));
    book.setAttributeNode(id);
    text = doc.createTextNode(ui->lineEdit_name->text());
    title.appendChild(text);
    text = doc.createTextNode(ui->lineEdit_author->text());
    author.appendChild(text);
    book.appendChild(title);
    book.appendChild(author);
    root.appendChild(book);
    if(!file.open(QIODevice::WriteOnly | QIODevice::Truncate))
    {
        return;
    }
    QTextStream out(&file);
    doc.save(out, 4);
    file.close();
    ui->listWidget->clear();
    ui->listWidget->addItem(tr("添加成功"));
}
static PyObject *meth_QDomElement_setAttributeNode(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        const QDomAttr * a0;
        QDomElement *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ9", &sipSelf, sipType_QDomElement, &sipCpp, sipType_QDomAttr, &a0))
        {
            QDomAttr *sipRes;

            Py_BEGIN_ALLOW_THREADS
            sipRes = new QDomAttr(sipCpp->setAttributeNode(*a0));
            Py_END_ALLOW_THREADS

            return sipConvertFromNewType(sipRes,sipType_QDomAttr,NULL);
        }
    }
QDomElement ExerciseWindow::getBlocks(const FCWidget *fc, QDomDocument &doc, QString Name)
{
    int n = fc->layout()->count();
    int i = 0;
    QDomElement domElement = doc.createElement(Name);
    while (i < n) {
        QDomElement block;
        QDomAttr attr = doc.createAttribute("text");
        QString tag = fc->layout()->itemAt(i)->widget()->metaObject()->className();
        if (tag != "FCLine" && tag != "FCLeftLine" && tag != "RightLine") {
            block = doc.createElement(tag);
            FCWidget *widget = (FCWidget*)fc->layout()->itemAt(i)->widget();
            attr.setValue(widget->getText());
            block.setAttributeNode(attr);
            domElement.appendChild(block);
            if (tag == "FCDivarWidget") {
                FCDivarWidget *divar = (FCDivarWidget*)widget;
                QDomElement left = getBlocks(divar->getRightLine(), doc, "Left");
                QDomElement right = getBlocks(divar->getLeftLine(), doc, "Right");
                block.appendChild(left);
                block.appendChild(right);
            }
            else if (tag == "FCPrefixCycleWidget") {
                FCPrefixCycleWidget *cycle = (FCPrefixCycleWidget*)widget;
                QDomElement body = getBlocks(cycle->getCycleBody(), doc, "Body");
                block.appendChild(body);
            }
            else if (tag == "FCPostfixCycleWidget") {
                FCPostfixCycleWidget *cycle = (FCPostfixCycleWidget*)widget;
                QDomElement body = getBlocks(cycle->getCycleBody(), doc, "Body");
                block.appendChild(body);
            }
            else if (tag == "FCParameterCycleWidget") {
                FCParameterCycleWidget *cycle = (FCParameterCycleWidget*)widget;
                QDomElement body = getBlocks(cycle->getCycleBody(), doc, "Body");
                block.appendChild(body);
            }
        }
        i++;
    }
    return domElement;
}
QDomElement makeElement(      QDomDocument& domDoc,
                        const QString&      strName,
                        const QString&      strAttr = QString::null,
                        const QString&      strText = QString::null
                       )
{
    QDomElement domElement = domDoc.createElement(strName);

    if (!strAttr.isEmpty()) {
        QDomAttr domAttr = domDoc.createAttribute("number");
        domAttr.setValue(strAttr);
        domElement.setAttributeNode(domAttr);
    }

    if (!strText.isEmpty()) {
        QDomText domText = domDoc.createTextNode(strText);
        domElement.appendChild(domText);
    }
    return domElement;
}
void XmlDataPersistance::saveDegree(Degree *degree, QDomElement &element, QDomDocument &dom)
{
    QDomElement degreeElement = dom.createElement("item");
    degreeElement.setAttribute("type",degree->type());
    element.appendChild(degreeElement);

    QDomElement titleElement = dom.createElement("titre");
    titleElement.appendChild(dom.createTextNode(degree->title()));
    degreeElement.appendChild(titleElement);

    QDomElement typeElement = dom.createElement("type");
    typeElement.appendChild(dom.createTextNode(degree->type()));
    degreeElement.appendChild(typeElement);

    const QList<const Uv*> &uvs = degree->uvs();
    for(int i = 0; i < uvs.size(); i++)
    {
        QDomElement uvElement = dom.createElement("uv");
        uvElement.appendChild(dom.createTextNode(uvs.at(i)->code()));
        degreeElement.appendChild(uvElement);
    }

    const QMap<QString,int> &quotas = degree->quotas();
    QMapIterator<QString,int> it(quotas);
    while(it.hasNext())
    {
        it.next();
        QDomElement quotaElement = dom.createElement("quota");
        QDomAttr cat = dom.createAttribute("categorie");
        cat.setNodeValue(it.key());
        quotaElement.setAttributeNode(cat);
        quotaElement.appendChild(dom.createTextNode(QString::number(it.value())));
        degreeElement.appendChild(quotaElement);
    }

    const QList<Degree*> &children = degree->children();
    for(int i = 0; i < children.size(); i++)
        saveDegree(children.at(i),degreeElement,dom);
}
Example #10
0
static PyObject *meth_QDomElement_setAttributeNode(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        const QDomAttr* a0;
        QDomElement *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ9", &sipSelf, sipType_QDomElement, &sipCpp, sipType_QDomAttr, &a0))
        {
            QDomAttr*sipRes;

            sipRes = new QDomAttr(sipCpp->setAttributeNode(*a0));

            return sipConvertFromNewType(sipRes,sipType_QDomAttr,NULL);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QDomElement, sipName_setAttributeNode, doc_QDomElement_setAttributeNode);

    return NULL;
}
// 创建节点
void Widget::createNodes(QDomElement &date)
{
        QDomElement time = doc.createElement(QString("时间"));
        QDomAttr curTime = doc.createAttribute("time");
        curTime.setValue(getDateTime(Time));
        time.setAttributeNode(curTime);
        date.appendChild(time);

        QDomElement type = doc.createElement(QString("类型"));
        QDomElement brand = doc.createElement(QString("品牌"));
        QDomElement price = doc.createElement(QString("单价"));
        QDomElement num = doc.createElement(QString("数量"));
        QDomElement sum = doc.createElement(QString("金额"));
        QDomText text;
        text = doc.createTextNode(QString("%1")
                                  .arg(ui->sellTypeComboBox->currentText()));
        type.appendChild(text);
        text = doc.createTextNode(QString("%1")
                                  .arg(ui->sellBrandComboBox->currentText()));
        brand.appendChild(text);
        text = doc.createTextNode(QString("%1")
                                  .arg(ui->sellPriceLineEdit->text()));
        price.appendChild(text);
        text = doc.createTextNode(QString("%1")
                                  .arg(ui->sellNumSpinBox->value()));
        num.appendChild(text);
        text = doc.createTextNode(QString("%1")
                                  .arg(ui->sellSumLineEdit->text()));
        sum.appendChild(text);

        time.appendChild(type);
        time.appendChild(brand);
        time.appendChild(price);
        time.appendChild(num);
        time.appendChild(sum);
}
Example #12
0
static QDomElement oldStyleNS(const QDomElement &e)
{
	// find closest parent with a namespace
	QDomNode par = e.parentNode();
	while(!par.isNull() && par.namespaceURI().isNull())
		par = par.parentNode();
	bool noShowNS = false;
	if(!par.isNull() && par.namespaceURI() == e.namespaceURI())
		noShowNS = true;

	QDomElement i;
	uint x;
	//if(noShowNS)
		i = e.ownerDocument().createElement(e.tagName());
	//else
	//	i = e.ownerDocument().createElementNS(e.namespaceURI(), e.tagName());

	// copy attributes
	QDomNamedNodeMap al = e.attributes();
	for(x = 0; x < al.count(); ++x)
		i.setAttributeNode(al.item(x).cloneNode().toAttr());

	if(!noShowNS)
		i.setAttribute("xmlns", e.namespaceURI());

	// copy children
	QDomNodeList nl = e.childNodes();
	for(x = 0; x < nl.count(); ++x) {
		QDomNode n = nl.item(x);
		if(n.isElement())
			i.appendChild(oldStyleNS(n.toElement()));
		else
			i.appendChild(n.cloneNode());
	}
	return i;
}
void RedisConnectionConfig::saveXmlAttribute(QDomDocument & document, QDomElement & root, const QString& name, const QString& value)
{
    QDomAttr attr = document.createAttribute(name);
    attr.setValue(value);
    root.setAttributeNode(attr);
}
Example #14
0
void writeJob::addNormalWidget(const QString property, const QString desc, const QString datatype,
                               const QString min, const QString max, const QString displaytype,
                               const QString displayvalue, const QStringList optiontextList,
                               const QStringList optionvalueList, const QString id, const QString boxID,
                               const QList<QString> radioIDList)
{
//    qDebug()<<"writeJob::addNormalWidget::"<<  property<<   desc<<   datatype<<min<<   max<<   displaytype<<
//            displayvalue<<   optiontextList<<   optionvalueList<<id<<boxID<<radioIDList;

    // 1.打开文件,分析文件,准备添加
    if(alreadyReadJob==false)
    {
        if(!readJob())
        {
            qDebug()<<"readJob failed";
        }
    }
    // 2. 添加各个属性
    QDomElement propertyEle =  doc.createElement("property");
    QDomElement descEle =  doc.createElement("desc");
    QDomElement datatypeEle =  doc.createElement("datatype");
    QDomElement minEle =  doc.createElement("min");
    QDomElement maxEle =  doc.createElement("max");
    QDomElement displaytypeEle =  doc.createElement("displaytype");
    QDomElement idEle =  doc.createElement("id");
    //    QDomElement optiontextEle =  doc.createElement("option");  //多次创建,且在内层,不应当在此创建。
    if(!property.isEmpty())
    {
        QDomAttr idAttr=doc.createAttribute("id");   // 写上id和名字用来判断
        if(id!="")
        {
            idAttr.setValue(id);
        }
        if(id=="")
        {
            idAttr.setValue(boxID);  //还要在下面的radio中加入id阿(radioIDList)
        }
        QDomAttr propertyAttr=doc.createAttribute("name");
        propertyAttr.setValue(property);

        propertyEle.setAttributeNode(idAttr);
        propertyEle.setAttributeNode(propertyAttr);
        moduleEle.appendChild(propertyEle);    /// 应该将module添加进来
    }

    if(!desc.isEmpty())
    {
        QDomText descText=doc.createTextNode(desc);
        descEle.appendChild(descText);
        propertyEle.appendChild(descEle);
    }
    if(!datatype.isEmpty())
    {
        QDomText datatypeText=doc.createTextNode(datatype);
        datatypeEle.appendChild(datatypeText);
        propertyEle.appendChild(datatypeEle);
    }
    if(!min.isEmpty())
    {
        QDomText minText=doc.createTextNode(min);
        minEle.appendChild(minText);
        propertyEle.appendChild(minEle);
    }
    if(!max.isEmpty())
    {
        QDomText maxText=doc.createTextNode(max);
        maxEle.appendChild(maxText);
        propertyEle.appendChild(maxEle);
    }
    if(!displaytype.isEmpty())
    {
        QDomAttr displaytypeAttr=doc.createAttribute("name");
        displaytypeAttr.setValue(displaytype);

        displaytypeEle.setAttributeNode(displaytypeAttr);

        /// ----------------------radio && combo---------------------------- ///
        if(!optiontextList.isEmpty())
        {
            for(int i=0;i<optiontextList.size();i++)
            {
                QDomElement optiontextEle =  doc.createElement("option");   // 这个是要动态创建的,因为要多个。。。

                QDomAttr optiontextAttr=doc.createAttribute("value");
                optiontextAttr.setValue(optiontextList.at(i));
                optiontextEle.setAttributeNode(optiontextAttr);

                ///                <option value="CMP" id="Z2Q3bfYnd4KqMrx">checked</option>
                if(!radioIDList.isEmpty())   //写上radioButton的id
                {
                    QDomAttr optionRadioAttr=doc.createAttribute("id");
                    optionRadioAttr.setValue(radioIDList.at(i));
                    optiontextEle.setAttributeNode(optionRadioAttr);
                }
                if(!optionvalueList.isEmpty())
                {
                    QDomText optionvalueText=doc.createTextNode(optionvalueList.at(i));
                    optiontextEle.appendChild(optionvalueText);
                }

                displaytypeEle.appendChild(optiontextEle);
            }
        }
        /// -------------------------------------------------- ///

        // 这里会有多余数据,禁用他
        if(!displayvalue.isEmpty() && optiontextList.isEmpty())
        {
            QDomText displayvalueText=doc.createTextNode(displayvalue);
            displaytypeEle.appendChild(displayvalueText);
        }
        propertyEle.appendChild(displaytypeEle);
    }

    if(!write())
        qDebug()<<"writejob failed";

}
int main(int argc, char *argv[])

{QCoreApplication a(argc,argv);

       QFile file( "domwrite.kdevelop" );

       if ( !file.open( QIODevice::WriteOnly | QIODevice::Truncate ) ){
              return 0;
       }else{
           qDebug()<<"OPEN!";
       }



       QDomDocument doc;

       QDomText text;

       QDomElement element;

       QDomProcessingInstruction instruction;

       instruction = doc.createProcessingInstruction( "xml", "version = \'1.0\'" );

       doc.appendChild( instruction );

       QDomElement root = doc.createElement( "kdevelop" );

       doc.appendChild( root );

       QDomElement general = doc.createElement( "general" );

       root.appendChild( general );



       element = doc.createElement( "author" );

       text = doc.createTextNode( "zeki" );



       general.appendChild( element );
        element.appendChild( text );



       element = doc.createElement( "email" );

       text = doc.createTextNode( "caizhiming@tom.com" );

       element.appendChild( text );

       general.appendChild( element );



       element = doc.createElement( "version" );

       text = doc.createTextNode( "$VERSION" );

       element.appendChild( text );

       general.appendChild( element );



       QDomElement keywords = doc.createElement( "keywords" );

       element = doc.createElement( "keyword" );

       text = doc.createTextNode( "C++" );

       element.appendChild( text );

       keywords.appendChild( element );

       general.appendChild( keywords );



       element = doc.createElement( "ignoreparts" );

       general.appendChild( element );



       QDomElement kdevfileview = doc.createElement( "kdevfileview" );

       QDomElement groups = doc.createElement( "groups" );

       element = doc.createElement( "group" );

       QDomAttr pattern = doc.createAttribute( "pattern" );

       pattern.setValue( "*.cpp;*.cxx;*.h" );

       QDomAttr name = doc.createAttribute( "name" );

       name.setValue( "Sources" );

       element.setAttributeNode( pattern );

       element.setAttributeNode( name );

       groups.appendChild( element );

       kdevfileview.appendChild( groups );

       root.appendChild( kdevfileview );





       QTextStream out( &file );

       doc.save( out, 4 );

    file.close();

       a.exec();

}
Example #16
0
void schedulexmldata::addschedulexmldata(QString tmpscheduledate, QString tmpid, QString tmptheme, QString tmpoccurtime, QString tmpoccuraddress,
                                         /*QString tmpremindtime, QString tmpremindway, QString tmpremindsequence,*/ QString tmpeventrepeat, QString tmpdetail)
{
    QFile file("/home/user/.scheduledata.xml");
    if(!file.open(QIODevice::ReadOnly))  return;
    QDomDocument doc;
    if(!doc.setContent(&file)){
        file.close();
        return;
    }
    file.close();

    QDomText text;

    QDomElement root = doc.documentElement();
    QDomElement scheduledate = doc.createElement(QString("scheduledate"));
    QDomAttr scheduledateattr = doc.createAttribute(QString("scheduledateattr"));
    scheduledate.setAttributeNode(scheduledateattr);
    QDomElement schedule = doc.createElement(QString("schedule"));

    QDomNode n = root.firstChild();
    if(n.toElement().attribute(QString("scheduledateattr")) == "00000000"){
        root.removeChild(n);
        root.appendChild(scheduledate);
        scheduledateattr.setValue(tmpscheduledate);
        scheduledate.appendChild(schedule);
    }else{
        bool scheduledateisexistence = false;
        while(!n.isNull()){
            if((n.previousSibling().toElement().attribute(QString("scheduledateattr")) <  tmpscheduledate) &&( tmpscheduledate < n.toElement().attribute(QString("scheduledateattr")))){
                root.insertBefore(scheduledate, n);
                scheduledateattr.setValue(tmpscheduledate);
                scheduledate.appendChild(schedule);
                scheduledateisexistence = true;
            }else if(tmpscheduledate == n.toElement().attribute(QString("scheduledateattr"))){
                n.toElement().appendChild(schedule);
                scheduledateisexistence = true;
            }
            n = n.nextSibling();
        }
        if(!scheduledateisexistence){
            root.appendChild(scheduledate);
            scheduledateattr.setValue(tmpscheduledate);
            scheduledate.appendChild(schedule);
        }
    }


    if(tmpid == "-10"){
        QDomNode nn = root.firstChild();
        while(!nn.isNull()){
            if(tmpscheduledate == nn.toElement().attribute(QString("scheduledateattr"))){
                QDomNodeList schedulelist = nn.toElement().elementsByTagName(QString("schedule"));
                tmpid.setNum(schedulelist.count() - 1);
                qDebug() << tmpid;
            }
            nn = nn.nextSibling();
        }
    }

    QDomAttr scheduleid = doc.createAttribute(QString("id"));
    scheduleid.setValue(QString(tmpid));
    schedule.setAttributeNode(scheduleid);
    QDomElement theme = doc.createElement(QString("theme"));
    text = doc.createTextNode(QString(tmptheme));
    theme.appendChild(text);
    schedule.appendChild(theme);
    QDomElement occurtime = doc.createElement(QString("occurtime"));
    text = doc.createTextNode(QString(tmpoccurtime));
    occurtime.appendChild(text);
    schedule.appendChild(occurtime);
    QDomElement occuraddress = doc.createElement(QString("occuraddress"));
    text = doc.createTextNode(QString(tmpoccuraddress));
    occuraddress.appendChild(text);
    schedule.appendChild(occuraddress);
//    QDomElement remindtime = doc.createElement(QString("remindtime"));
//    text = doc.createTextNode(QString(tmpremindtime));
//    remindtime.appendChild(text);
//    schedule.appendChild(remindtime);
//    QDomElement remindway = doc.createElement(QString("remindway"));
//    text = doc.createTextNode(QString(tmpremindway));
//    remindway.appendChild(text);
//    schedule.appendChild(remindway);
//    QDomElement remindsequence = doc.createElement(QString("remindsequence"));
//    text = doc.createTextNode(QString(tmpremindsequence));
//    remindsequence.appendChild(text);
//    schedule.appendChild(remindsequence);
    QDomElement eventrepeat = doc.createElement(QString("eventrepeat"));
    text = doc.createTextNode(QString(tmpeventrepeat));
    eventrepeat.appendChild(text);
    schedule.appendChild(eventrepeat);
    QDomElement detail = doc.createElement(QString("detail"));
    text = doc.createTextNode(QString(tmpdetail));
    detail.appendChild(text);
    schedule.appendChild(detail);

    if( !file.open(QIODevice::WriteOnly | QIODevice::Truncate)) return;
    QTextStream out(&file);
    doc.save(out, 4);
    file.close();
}
Example #17
0
void schedulexmldata::initschedulexmldata()
{
    QFile file("/home/user/.scheduledata.xml");
    if( !file.open(QIODevice::ReadWrite))
        return;
    QFileInfo fileinfo(file);
    if(fileinfo.size() == 0){
        file.close();
        QDomDocument doc;
        QDomProcessingInstruction instruction;
        instruction = doc.createProcessingInstruction("xml","version=\"1.0\" encoding=\"UTF-8\"");
        doc.appendChild(instruction);

        QDomElement root = doc.createElement(QString("scheduledata"));
        doc.appendChild(root);
        QDomText text;

        QDomElement scheduledate = doc.createElement(QString("scheduledate"));
        root.appendChild(scheduledate);
        QDomAttr scheduledateattr = doc.createAttribute(QString("scheduledateattr"));
        scheduledateattr.setValue(QString("00000000"));
        scheduledate.setAttributeNode(scheduledateattr);

        QDomElement schedule = doc.createElement(QString("schedule"));
        scheduledate.appendChild(schedule);
        QDomAttr scheduleid = doc.createAttribute(QString("id"));
        scheduleid.setValue(QString("0"));
        schedule.setAttributeNode(scheduleid);

        QDomElement theme = doc.createElement(QString("theme"));
        text = doc.createTextNode(QString(""));
        theme.appendChild(text);
        schedule.appendChild(theme);
        QDomElement occurtime = doc.createElement(QString("occurtime"));
        text = doc.createTextNode(QString(""));
        occurtime.appendChild(text);
        schedule.appendChild(occurtime);
        QDomElement occuraddress = doc.createElement(QString("occuraddress"));
        text = doc.createTextNode(QString(""));
        schedule.appendChild(occuraddress);
//        QDomElement remindtime = doc.createElement(QString("remindtime"));
//        text = doc.createTextNode(QString(""));
//        remindtime.appendChild(text);
//        schedule.appendChild(remindtime);
//        QDomElement remindway = doc.createElement(QString("remindway"));
//        text = doc.createTextNode(QString(""));
//        remindway.appendChild(text);
//        schedule.appendChild(remindway);
//        QDomElement remindsequence = doc.createElement(QString("remindsequence"));
//        text = doc.createTextNode(QString(""));
//        remindsequence.appendChild(text);
//        schedule.appendChild(remindsequence);
        QDomElement eventrepeat = doc.createElement(QString("eventrepeat"));
        text = doc.createTextNode(QString(""));
        eventrepeat.appendChild(text);
        schedule.appendChild(eventrepeat);
        QDomElement detail = doc.createElement(QString("detail"));
        text = doc.createTextNode(QString(""));
        detail.appendChild(text);
        schedule.appendChild(detail);

        if( !file.open(QIODevice::WriteOnly | QIODevice::Truncate)) return;
        QTextStream out(&file);
        doc.save(out, 4);
        file.close();
    }else{
        file.close();
    }
}
Example #18
0
 bool MdiEditor::WriteXmlFile(QString filename)
 {
 	//getParameters();
  	QFile file(filename);
  	if(file.open(QIODevice::WriteOnly | QIODevice::Truncate |QIODevice::Text))
  	{
  		QString str;
  		QDomDocument doc;
  		QDomText text;
  		QDomElement element;
  		QDomAttr attribute;

  		QDomProcessingInstruction instruction = doc.createProcessingInstruction("xml","version=\'1.0\'");
  		doc.appendChild(instruction);

   		QDomElement root = doc.createElement("project");
   		doc.appendChild(root);

  		//Images
   		QDomElement eimages=doc.createElement("images");
   		root.appendChild(eimages);

   		attribute=doc.createAttribute("image1");
  		attribute.setValue("/image1.png");

  		eimages.setAttributeNode(attribute);
		QString filename;
		filename.sprintf("%s/image1.png",pro_path.toLatin1().data());
		cv::imwrite(filename.toLatin1().data(),image1);

  		attribute=doc.createAttribute("image2");

  		attribute.setValue("\\image2.png");


  		eimages.setAttributeNode(attribute);

		filename.sprintf("%s\\image2.png",pro_path.toLatin1().data());

		cv::imwrite(filename.toLatin1().data(),image2);

   		//layer
 		QDomElement elayers=doc.createElement("layers");
 		root.appendChild(elayers);

 		attribute=doc.createAttribute("num");
 		attribute.setValue(str.sprintf("%d",layer_num));
 		elayers.setAttributeNode(attribute);

 		for(int index=0;index<layer_num;index++)
 		{
 			QDomElement elayer=doc.createElement(str.sprintf("l%d",index));
 			elayers.appendChild(elayer);

			QDir dir;
			QString filename;

			filename.sprintf("%s\\%d",pro_path.toLatin1().data(),index);

			dir.mkdir(filename);

			//masks
 			QDomElement emask=doc.createElement("masks");
 			elayer.appendChild(emask);

 			attribute=doc.createAttribute("mask1");

 			attribute.setValue(str.sprintf("\\%d\\mask1.png",index));

 			emask.setAttributeNode(attribute);

			filename.sprintf("%s\\%d\\mask1.png",pro_path.toLatin1().data(),index);

			cv::imwrite(filename.toLatin1().data(),parameters[index].mask1);

 			attribute=doc.createAttribute("mask2");

 			attribute.setValue(str.sprintf("\\%d\\mask2.png",index));

 			emask.setAttributeNode(attribute);

			filename.sprintf("%s\\%d\\mask2.png",pro_path.toLatin1().data(),index);

			cv::imwrite(filename.toLatin1().data(),parameters[index].mask2);


 			//parameters
 			QDomElement epara=doc.createElement("parameters");
 			elayer.appendChild(epara);

 			//weight
 			element=doc.createElement("weight");
 			epara.appendChild(element);

 			attribute=doc.createAttribute("ssim");
 			attribute.setValue(str.sprintf("%f",parameters[index].w_ssim));
 			element.setAttributeNode(attribute);

 			attribute=doc.createAttribute("tps");
 			attribute.setValue(str.sprintf("%f",parameters[index].w_tps));
 			element.setAttributeNode(attribute);

 			attribute=doc.createAttribute("ui");
 			attribute.setValue(str.sprintf("%f",parameters[index].w_ui));
 			element.setAttributeNode(attribute);

 			attribute=doc.createAttribute("ssimclamp");
 			attribute.setValue(str.sprintf("%f",1.0-parameters[index].ssim_clamp));
 			element.setAttributeNode(attribute);

 			//control points
 			element=doc.createElement("points");
 			epara.appendChild(element);

 			attribute=doc.createAttribute("image1");
 			str="";
 			for(size_t i=0;i<parameters[index].ui_points.size();i++)
 			{
 				QString num;
 				str.append(num.sprintf("%f ",parameters[index].ui_points[i].lp.x));
 				str.append(num.sprintf("%f ",parameters[index].ui_points[i].lp.y));
 			}
 			attribute.setValue(str);
 			element.setAttributeNode(attribute);


 			attribute=doc.createAttribute("image2");
 			str="";
 			for(size_t i=0;i<parameters[index].ui_points.size();i++)
 			{
 				QString num;
 				str.append(num.sprintf("%f ",parameters[index].ui_points[i].rp.x));
 				str.append(num.sprintf("%f ",parameters[index].ui_points[i].rp.y));
 			}
 			attribute.setValue(str);
 			element.setAttributeNode(attribute);

 			//boundary
 			element=doc.createElement("boundary");
 			epara.appendChild(element);

 			attribute=doc.createAttribute("lock");
			int bcond=0;
			switch(parameters[index].bcond)
			{
			case BCOND_NONE:
				bcond=0;
				break;
			case BCOND_CORNER:
				bcond=1;
				break;
			case BCOND_BORDER:
				bcond=2;
				break;
			}
 			attribute.setValue(str.sprintf("%d",bcond));
 			element.setAttributeNode(attribute);


 			//debug
 			element=doc.createElement("debug");
 			epara.appendChild(element);

 			attribute=doc.createAttribute("iternum");
 			attribute.setValue(str.sprintf("%d",parameters[index].max_iter));
 			element.setAttributeNode(attribute);

 			attribute=doc.createAttribute("dropfactor");
 			attribute.setValue(str.sprintf("%f",parameters[index].max_iter_drop_factor));
 			element.setAttributeNode(attribute);

 			attribute=doc.createAttribute("eps");
 			attribute.setValue(str.sprintf("%f",parameters[index].eps));
 			element.setAttributeNode(attribute);

 			attribute=doc.createAttribute("startres");
 			attribute.setValue(str.sprintf("%d",parameters[index].start_res));
 			element.setAttributeNode(attribute);

 		}

   		QTextStream out(&file);
  		out.setCodec("UTF-8");
  		doc.save(out,4);

  		file.close();
 		return true;
  	}

 	return false;
 }
Example #19
0
int main(int argc, char *argv[])
{
	QFile file("domwrite.kdevelop");
	if(!file.open(QIODevice::WriteOnly | QIODevice::Truncate))
	{
		cout << "Can't create file!" << endl;
		return 1;
	}
	QDomDocument doc;
	QDomText text;
	QDomElement element;
	QDomProcessingInstruction instruction;
	instruction = doc.createProcessingInstruction("xml","version=\'1.0\'");
	doc.appendChild(instruction);

	QDomElement root = doc.createElement("kdevelop");
	doc.appendChild(root);
	QDomElement general = doc.createElement("general");
	root.appendChild(general);
	
	element = doc.createElement("author");
	text = doc.createTextNode("zeki");
	element.appendChild(text);
	general.appendChild(element);
	
	element = doc.createElement("email");
	text = doc.createTextNode("caizhiming@tom.com");
	element.appendChild(text);
	general.appendChild(element);
	
	element = doc.createElement("version");
	text = doc.createTextNode("$VERSION");
	element.appendChild(text);
	general.appendChild(element);
	
	element = doc.createElement("projectmanagement");
	text = doc.createTextNode("KdevTrollProject");
	element.appendChild(text);
	general.appendChild(element);
	
	element = doc.createElement("primarylanguage");
	text = doc.createTextNode("C++");
	element.appendChild(text);
	general.appendChild(element);

	QDomElement keywords = doc.createElement("keywords");
	element = doc.createElement("keyword");
	text = doc.createTextNode("C++");
	element.appendChild(text);
	keywords.appendChild(element);
	general.appendChild(keywords);
	
	element = doc.createElement("projectname");
	text = doc.createTextNode("domwrite");
	element.appendChild(text);
	general.appendChild(element);
	
	element = doc.createElement("ignoreparts");
	general.appendChild(element);
	
	element = doc.createElement("projectdirectory");
	text = doc.createTextNode(".");
	element.appendChild(text);
	general.appendChild(element);
	
	element = doc.createElement("absoluteprojectpath");
	text = doc.createTextNode("false");
	element.appendChild(text);
	general.appendChild(element);
	
	element = doc.createElement("description");
	general.appendChild(element);
	
	element = doc.createElement("defaultencoding");
	general.appendChild(element);
	
	QDomElement kdevfileview = doc.createElement("kdevfileview");
	QDomElement groups = doc.createElement("groups");
	element = doc.createElement("group");
	QDomAttr pattern = doc.createAttribute("pattern");
	pattern.setValue("*.cpp;*.cxx;*.h");
	QDomAttr name = doc.createAttribute("name");
	name.setValue("Sources");
	element.setAttributeNode(pattern);
	element.setAttributeNode(name);
	groups.appendChild(element);
	kdevfileview.appendChild(groups);
	root.appendChild(kdevfileview);
		
	QTextStream out(&file);
	doc.save(out, 4);
	
	return 0;
}
void ExerciseWindow::generateXML(QDomElement &domElement, QDomDocument &doc)
{
    int length = rand()%10+5;
    int choice = 0;
    int var_choice = 0;
    int i = 0;
    QDomElement block = doc.createElement("FCBeginWidget");
    QString sAttr = "operator()";
    QDomAttr attr = doc.createAttribute("text");
    domElement.appendChild(block);

    while (i < length) {
        choice = rand()%7;
        attr = doc.createAttribute("text");
        var_choice = rand()%vars.size();
        QString var = vars[var_choice];
        switch(choice) {
        case 0: {
            block = doc.createElement("FCActionWidget");
            sAttr = var + " = " + QString::number(rand()%10);
            attr.setValue(sAttr);

        }
        break;
        case 1: {
            block = doc.createElement("FCInputWidget");
            attr.setValue(var);
        }
        break;
        case 2: {
            block = doc.createElement("FCOutputWidget");
            attr.setValue(var);
        }
        break;
        case 3: {
            block = doc.createElement("FCDivarWidget");
            QString decision = var + " == " + QString::number(5);
            if (i%2 == 0) decision = var + " < " + QString::number(10);
            else decision = var + " > " + QString::number(0);
            attr.setValue(decision);
            QDomElement left = doc.createElement("Left");
            QDomElement right = doc.createElement("Right");
            block.appendChild(left);
            block.appendChild(right);
            QDomElement blockTrue = doc.createElement("FCActionWidget");
            QDomElement blockFalse = doc.createElement("FCActionWidget");
            QDomAttr attribute = doc.createAttribute("text");
            attribute.setValue(var + "++");
            blockTrue.setAttributeNode(attribute);
            attribute = doc.createAttribute("text");
            attribute.setValue(var + "--");
            blockFalse.setAttributeNode(attribute);
            left.appendChild(blockTrue);
            right.appendChild(blockFalse);
        }
        break;
        case 4: {
            block = doc.createElement("FCPrefixCycleWidget");
            QString decision = var + " < " + QString::number(i * 5);
            attr.setValue(decision);
            QDomElement body = doc.createElement("Body");
            block.appendChild(body);
            QDomElement blockTrue = doc.createElement("FCActionWidget");
            QDomAttr attribute = doc.createAttribute("text");
            attribute.setValue(var + "++");
            blockTrue.setAttributeNode(attribute);
            body.appendChild(blockTrue);
        }
        break;
        case 5: {
            block = doc.createElement("FCPostfixCycleWidget");
            QString decision = var + " < " + QString::number(i * 5);
            attr.setValue(decision);
            QDomElement body = doc.createElement("Body");
            block.appendChild(body);
            QDomElement blockTrue = doc.createElement("FCActionWidget");
            QDomAttr attribute = doc.createAttribute("text");
            attribute.setValue(var + "++");
            blockTrue.setAttributeNode(attribute);
            body.appendChild(blockTrue);
        }
        break;
        case 6: {
            block = doc.createElement("FCParameterCycleWidget");
            QString decision = "int i = 0; i < " + QString::number(i * 5) + "; i++";
            attr.setValue(decision);
            QDomElement body = doc.createElement("Body");
            block.appendChild(body);
            QDomElement blockTrue = doc.createElement("FCActionWidget");
            QDomAttr attribute = doc.createAttribute("text");
            attribute.setValue(var + "++");
            blockTrue.setAttributeNode(attribute);
            body.appendChild(blockTrue);
        }
        }
        block.setAttributeNode(attr);
        domElement.appendChild(block);
        i++;
    }
    block = doc.createElement("FCEndWidget");
    domElement.appendChild(block);
}
Example #21
0
///  id没有加入,无法修改
void writeJob::addHideWidget(const QString property, const QString desc, const QString datatype,
                                const QString min, const QString max, const QString displaytype,
                                const QString displayvalue, const QStringList optiontext, const QStringList optionvalue,
                                const QString visible, const QString boxID, const QString lineID)
{
    qDebug()<<"writeJob::addHideWidget"<<  property<<   desc<<   datatype<<min<<   max<<   displaytype<<
            displayvalue<<   optiontext<<   optionvalue<< visible<<boxID<<lineID;

    if(alreadyReadJob==false)
    {
        if(!readJob())
        {
            qDebug()<<"readJob failed";
        }
    }
    QDomElement root = doc.documentElement();

    QDomElement propertyEle =  doc.createElement("property");
    QDomElement descEle =  doc.createElement("desc");
    QDomElement datatypeEle =  doc.createElement("datatype");
    QDomElement minEle =  doc.createElement("min");
    QDomElement maxEle =  doc.createElement("max");
    QDomElement displaytypeEle =  doc.createElement("displaytype");
    QDomElement visibleEle =  doc.createElement("hide");  //much better than visible
    QDomElement bxoIDEle =  doc.createElement("id");
    if(!property.isEmpty())
    {
        QDomAttr idAttr=doc.createAttribute("id");   // 写上id和名字用来判断
        if(boxID!="")
        {
            idAttr.setValue(boxID);
        }
        if(boxID=="")
        {
            idAttr.setValue(boxID);  //还要在下面的radio中加入id阿(radioIDList)
        }
        QDomAttr propertyAttr=doc.createAttribute("name");
        propertyAttr.setValue(property);

        propertyEle.setAttributeNode(idAttr);
        propertyEle.setAttributeNode(propertyAttr);
        moduleEle.appendChild(propertyEle);    /// 应该将module添加进来
    }
    if(!desc.isEmpty())
    {
        QDomText descText=doc.createTextNode(desc);
        descEle.appendChild(descText);
        propertyEle.appendChild(descEle);
    }
    if(!datatype.isEmpty())
    {
        QDomText datatypeText=doc.createTextNode(datatype);
        datatypeEle.appendChild(datatypeText);
        propertyEle.appendChild(datatypeEle);
    }
    if(!min.isEmpty())
    {
        QDomText minText=doc.createTextNode(min);
        minEle.appendChild(minText);
        propertyEle.appendChild(minEle);
    }
    if(!max.isEmpty())
    {
        QDomText maxText=doc.createTextNode(max);
        maxEle.appendChild(maxText);
        propertyEle.appendChild(maxEle);
    }
    /// -------------------------------------------------- ///
    if(!displaytype.isEmpty())
    {
        QDomAttr displaytypeAttr=doc.createAttribute("name");
        displaytypeAttr.setValue(displaytype);

        displaytypeEle.setAttributeNode(displaytypeAttr);

        if(!lineID.isEmpty())
        {
            QDomAttr displaytypeIDAttr=doc.createAttribute("id");
            displaytypeIDAttr.setValue(lineID);
            displaytypeEle.setAttributeNode(displaytypeIDAttr);
        }
        if(!optiontext.isEmpty())
        {
            for(int i=0;i<optiontext.size();i++)
            {
                QDomElement optiontextEle =  doc.createElement("option");   // 这个是要动态创建的,因为要多个。。。

                QDomAttr optiontextAttr=doc.createAttribute("value");
                optiontextAttr.setValue(optiontext.at(i));
                optiontextEle.setAttributeNode(optiontextAttr);

                if(!optionvalue.isEmpty())
                {
                    QDomText optionvalueText=doc.createTextNode(optionvalue.at(i));
                    optiontextEle.appendChild(optionvalueText);
                }

                displaytypeEle.appendChild(optiontextEle);
            }
        }
        // 这里会有多余数据
        if(!displayvalue.isEmpty() && optiontext.isEmpty())
        {
            QDomText displayvalueText=doc.createTextNode(displayvalue);
            displaytypeEle.appendChild(displayvalueText);
        }
        propertyEle.appendChild(displaytypeEle);
    }
    /// -------------------------------------------------- ///

    if(!visible.isEmpty())
    {
        QDomText visibleText=doc.createTextNode(visible);
        visibleEle.appendChild(visibleText);
        propertyEle.appendChild(visibleEle);
    }


    if(!write())
        qDebug()<<"writejob failed";
}
/************************************************
 Its contents references an immediate sub-menu of the current menu, as such it should never contain
 a slash. If no such sub-menu exists the element should be ignored.
 This element may have various attributes, the default values are taken from the DefaultLayout key.

 show_empty [ bool ]
    defines whether a menu that contains no desktop entries and no sub-menus
    should be shown at all.

 inline [ bool ]
    If the inline attribute is "true" the menu that is referenced may be copied into the current
    menu at the current point instead of being inserted as sub-menu of the current menu.

 inline_limit [ int ]
    defines the maximum number of entries that can be inlined. If the sub-menu has more entries
    than inline_limit, the sub-menu will not be inlined. If the inline_limit is 0 (zero) there
    is no limit.

 inline_header [ bool ]
    defines whether an inlined menu should be preceded with a header entry listing the caption of
    the sub-menu.

 inline_alias [ bool ]
    defines whether a single inlined entry should adopt the caption of the inlined menu. In such
    case no additional header entry will be added regardless of the value of the inline_header
    attribute.

 Example: if a menu has a sub-menu titled "WordProcessor" with a single entry "OpenOffice 4.2", and
 both inline="true" and inline_alias="true" are specified then this would result in the
 "OpenOffice 4.2" entry being inlined in the current menu but the "OpenOffice 4.2" caption of the
 entry would be replaced with "WordProcessor".
 ************************************************/
void XdgMenuLayoutProcessor::processMenunameTag(const QDomElement &element)
{
    QString id = element.text();
    QDomElement menu = searchElement(QLatin1String("Menu"), QLatin1String("name"), id);
    if (menu.isNull())
        return;

    LayoutParams params = mDefaultParams;
    setParams(element, &params);

    int count = childsCount(menu);

    if (count == 0)
    {
        if (params.mShowEmpty)
        {
            menu.setAttribute(QLatin1String("keep"), QLatin1String("true"));
            mResult.appendChild(menu);
        }
        return;
    }


    bool doInline = params.mInline &&
                    (!params.mInlineLimit || params.mInlineLimit > count);

    bool doAlias = params.mInlineAlias &&
                   doInline && (count == 1);

    bool doHeader = params.mInlineHeader &&
                    doInline && !doAlias;


    if (!doInline)
    {
        mResult.appendChild(menu);
        return;
    }


    // Header ....................................
    if (doHeader)
    {
        QDomElement header = mLayout.ownerDocument().createElement(QLatin1String("Header"));

        QDomNamedNodeMap attrs = menu.attributes();
        for (int i=0; i < attrs.count(); ++i)
        {
            header.setAttributeNode(attrs.item(i).toAttr());
        }

        mResult.appendChild(header);
    }

    // Alias .....................................
    if (doAlias)
    {
        menu.firstChild().toElement().setAttribute(QLatin1String("title"), menu.attribute(QLatin1String("title")));
    }

    // Inline ....................................
    MutableDomElementIterator it(menu);
    while (it.hasNext())
    {
        mResult.appendChild(it.next());
    }

}
Example #23
0
void TwoDRenderer::saveMap( QString filePath )
{
	QFile file( filePath );
	if( false == file.open(QFile::WriteOnly) )
		return;
		
	#define MAP_STRUCTURE "<?xml version=\"1.0\" ?>" \
								"<delleriumMap>" \
									"<walls></walls>" \
									"<bushes></bushes>" \
									"<me>" \
										"<balls></balls>" \
										"<targets></targets>" \
									"</me>" \
									"<enemy>" \
										"<balls></balls>" \
										"<targets></targets>" \
									"</enemy>" \
								"</delleriumMap>"
	
	// here we build the XML strucuture for the map
	QDomDocument domDocument;
	domDocument.setContent( QString(MAP_STRUCTURE) );

	QDomNode rootNode = domDocument.documentElement();

	QDomNode wallsNode = getChildByName( rootNode, "walls" );
	QDomNode bushesNode = getChildByName( rootNode, "bushes" );

	QDomNode meBallsNode = getChildByName( getChildByName(rootNode,"me"), "balls" );
	QDomNode meTargetsNode = getChildByName( getChildByName(rootNode,"me"), "targets" );
	
	QDomNode enemyBallsNode = getChildByName( getChildByName(rootNode,"enemy"), "balls" );
	QDomNode enemyTargetsNode = getChildByName( getChildByName(rootNode,"enemy"), "targets" );

	QList<QGraphicsItem*> gameObjects = _scene->items();
	foreach( QGraphicsItem* item, gameObjects )
	{
		GameObject* gameObject = static_cast<GameObject*>( item );
		if( 0 != gameObject )
		{
			switch( gameObject->getObjectType() )
			{
				case GameObject::ObjectWall:
					{
						QDomElement element = domDocument.createElement( "wall" );
						QDomAttr attributeX = domDocument.createAttribute( "x" ); attributeX.setValue( QString("%1").arg(gameObject->x()) );
						QDomAttr attributeY = domDocument.createAttribute( "y" ); attributeY.setValue( QString("%1").arg(gameObject->y()) );
						element.setAttributeNode( attributeX );
						element.setAttributeNode( attributeY );
						wallsNode.appendChild( element );
					}
					break;
					
				case GameObject::ObjectBush:
					{
						QDomElement element = domDocument.createElement( "bush" );
						QDomAttr attributeX = domDocument.createAttribute( "x" ); attributeX.setValue( QString("%1").arg(gameObject->x()) );
						QDomAttr attributeY = domDocument.createAttribute( "y" ); attributeY.setValue( QString("%1").arg(gameObject->y()) );
						element.setAttributeNode( attributeX );
						element.setAttributeNode( attributeY );
			
						bushesNode.appendChild( element );
					}
					break;
		
				case GameObject::ObjectBall:
					{
						QDomElement element = domDocument.createElement( "ball" );
						QDomAttr attributeX = domDocument.createAttribute( "x" ); attributeX.setValue( QString("%1").arg(gameObject->x()) );
						QDomAttr attributeY = domDocument.createAttribute( "y" ); attributeY.setValue( QString("%1").arg(gameObject->y()) );
						element.setAttributeNode( attributeX );
						element.setAttributeNode( attributeY );

						meBallsNode.appendChild( element );
					}
					break;
					
				case GameObject::ObjectTarget:
					{
						QDomElement element = domDocument.createElement( "target" );
						QDomAttr attributeX = domDocument.createAttribute( "x" ); attributeX.setValue( QString("%1").arg(gameObject->x()) );
						QDomAttr attributeY = domDocument.createAttribute( "y" ); attributeY.setValue( QString("%1").arg(gameObject->y()) );
						element.setAttributeNode( attributeX );
						element.setAttributeNode( attributeY );

						meTargetsNode.appendChild( element );
					}
					break;
		
				case GameObject::ObjectEnemyBall:
					{
						QDomElement element = domDocument.createElement( "ball" );
						QDomAttr attributeX = domDocument.createAttribute( "x" ); attributeX.setValue( QString("%1").arg(gameObject->x()) );
						QDomAttr attributeY = domDocument.createAttribute( "y" ); attributeY.setValue( QString("%1").arg(gameObject->y()) );
						element.setAttributeNode( attributeX );
						element.setAttributeNode( attributeY );

						enemyBallsNode.appendChild( element );
					}
					break;
					
				case GameObject::ObjectEnemyTarget:
					{
						QDomElement element = domDocument.createElement( "target" );
						QDomAttr attributeX = domDocument.createAttribute( "x" ); attributeX.setValue( QString("%1").arg(gameObject->x()) );
						QDomAttr attributeY = domDocument.createAttribute( "y" ); attributeY.setValue( QString("%1").arg(gameObject->y()) );
						element.setAttributeNode( attributeX );
						element.setAttributeNode( attributeY );

						enemyTargetsNode.appendChild( element );
					}
					break;
					
				case GameObject::ObjectNone:
				default:
					break;
			}
		}
	}