当前位置: 首页>>代码示例>>C++>>正文


C++ TiXmlDocument::LinkEndChild方法代码示例

本文整理汇总了C++中TiXmlDocument::LinkEndChild方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlDocument::LinkEndChild方法的具体用法?C++ TiXmlDocument::LinkEndChild怎么用?C++ TiXmlDocument::LinkEndChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TiXmlDocument的用法示例。


在下文中一共展示了TiXmlDocument::LinkEndChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TiXmlDocument

TiXmlDocument * TcxBase::getGpxDocument() {
    TiXmlDocument * doc = new TiXmlDocument();

    TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", "no");
    doc->LinkEndChild( decl );

    TiXmlElement * gpx = new TiXmlElement( "gpx" );
    gpx->SetAttribute("xmlns","http://www.topografix.com/GPX/1/1");
    gpx->SetAttribute("xmlns:gpxx","http://www.garmin.com/xmlschemas/GpxExtensions/v3");
    gpx->SetAttribute("xmlns:gpxtpx","http://www.garmin.com/xmlschemas/TrackPointExtension/v1");
    gpx->SetAttribute("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance");
    gpx->SetAttribute("creator","GarminPlugin");
    gpx->SetAttribute("version","1.1");
    gpx->SetAttribute("xsi:schemaLocation","http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd");
    doc->LinkEndChild( gpx );

    vector<TcxActivities*>::iterator it;
    for ( it=activitiesList.begin() ; it < activitiesList.end(); it++ )
    {
        TcxActivities* activities = *it;
        vector<TiXmlElement*> trkElem = activities->getGpxTiXml();
        vector<TiXmlElement*>::iterator it;
        for ( it=trkElem.begin() ; it < trkElem.end(); it++ ) {
            TiXmlElement* elem = *it;
            gpx->LinkEndChild( elem );
        }
    }

    return doc;
}
开发者ID:daijoubu,项目名称:GarminPlugin,代码行数:30,代码来源:TcxBase.cpp

示例2: saveHashes

void EditorLevel::saveHashes() {
	TiXmlDocument doc;
	TiXmlDeclaration *decl = new TiXmlDeclaration( "1.0", "", "" );
	doc.LinkEndChild( decl );

	TiXmlElement *hashRoot = new TiXmlElement(SONICGLVL_LEVEL_HASH_ROOT);

	TiXmlElement *dataRoot = new TiXmlElement(SONICGLVL_LEVEL_HASH_DATA);
	for (size_t i=0; i<5; i++) {
		dataRoot->SetAttribute(SONICGLVL_LEVEL_HASH_VALUE_ATTRIBUTE + ToString(i), data_hash[i]);
	}
	hashRoot->LinkEndChild(dataRoot);

	TiXmlElement *terrainRoot = new TiXmlElement(SONICGLVL_LEVEL_HASH_TERRAIN);
	for (size_t i=0; i<5; i++) {
		terrainRoot->SetAttribute(SONICGLVL_LEVEL_HASH_VALUE_ATTRIBUTE + ToString(i), terrain_hash[i]);
	}
	hashRoot->LinkEndChild(terrainRoot);

	TiXmlElement *resourcesRoot = new TiXmlElement(SONICGLVL_LEVEL_HASH_RESOURCES);
	for (size_t i=0; i<5; i++) {
		resourcesRoot->SetAttribute(SONICGLVL_LEVEL_HASH_VALUE_ATTRIBUTE + ToString(i), resources_hash[i]);
	}
	hashRoot->LinkEndChild(resourcesRoot);

	doc.LinkEndChild(hashRoot);
	doc.SaveFile(cache_folder + SONICGLVL_LEVEL_HASH_FILENAME);
}
开发者ID:parax0,项目名称:libgens-sonicglvl-lostworld,代码行数:28,代码来源:EditorLevel.cpp

示例3: SaveConfigRule

void Config::SaveConfigRule()
{
    std::string file = Utils::getConfigFile(RULES_CONFIG);
    std::string tmp = file + "_tmp";

    cInfo() <<  "Saving " << file << "...";

    TiXmlDocument document;
    TiXmlDeclaration *decl = new TiXmlDeclaration("1.0", "UTF-8", "");
    TiXmlElement *rulesnode = new TiXmlElement("calaos:rules");
    rulesnode->SetAttribute("xmlns:calaos", "http://www.calaos.fr");
    document.LinkEndChild(decl);
    document.LinkEndChild(rulesnode);

    for (int i = 0;i < ListeRule::Instance().size();i++)
    {
        Rule *rule = ListeRule::Instance().get_rule(i);
        rule->SaveToXml(rulesnode);
    }

    if (document.SaveFile(tmp))
    {
        ecore_file_unlink(file.c_str());
        ecore_file_mv(tmp.c_str(), file.c_str());
    }

    cInfo() <<  "Done.";
}
开发者ID:expertisesolutions,项目名称:calaos_base,代码行数:28,代码来源:CalaosConfig.cpp

示例4: SaveInitParams

VAUTILS_API bool SaveInitParams(const char* lpFileName, TVAInitParams* params)
{
	if (lpFileName == NULL || params == NULL)
		return false;
	
	TiXmlElement* element = new TiXmlElement("VAPARAMS");
	TiXmlElement* e = new TiXmlElement("Camera");
	
	e->SetDoubleAttribute("height", params->Camera.Height);
	e->SetDoubleAttribute("angle", params->Camera.Angle);
	e->SetDoubleAttribute("focus", params->Camera.Focus);
	e->SetDoubleAttribute("wsize", params->Camera.WChipSize);
	e->SetDoubleAttribute("hsize", params->Camera.HChipSize);

	element->LinkEndChild(e);

	TiXmlElement* e1 = new TiXmlElement("Zones");
	//
	for (int i = 0; i < params->NumZones; i++)
	{
		if (params->Zones[i].IsRect)
		{
			//сохранить прямоугольник
			TiXmlElement* e3 = new TiXmlElement("rect");
			e3->SetDoubleAttribute("x", params->Zones[i].Rect.LeftTop.X);
			e3->SetDoubleAttribute("y", params->Zones[i].Rect.LeftTop.Y);
			e3->SetDoubleAttribute("bx", params->Zones[i].Rect.RightBottom.X);
			e3->SetDoubleAttribute("by", params->Zones[i].Rect.RightBottom.Y);
			e1->LinkEndChild(e3);
		}
		else
		{
			//сохранить контур
			TiXmlElement* e3 = new TiXmlElement("contour");
			for (int j = 0; j < params->Zones[i].NumPoints; j++)
			{
				TiXmlElement* e2 = new TiXmlElement("Point");
				e2->SetDoubleAttribute("x", params->Zones[i].Points[j].X);
				e2->SetDoubleAttribute("y", params->Zones[i].Points[j].Y);
				e3->LinkEndChild(e2);
			}
			e1->LinkEndChild(e3);
		}
	}
	element->LinkEndChild(e1);

	TiXmlElement* e3 = new TiXmlElement("sensitivity");
	e3->SetDoubleAttribute("eventsens", params->EventSens);
	e3->SetDoubleAttribute("eventtimesens", params->EventTimeSens);
	element->LinkEndChild(e3);

    TiXmlDocument doc;
    TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );
    doc.LinkEndChild( decl );
	doc.LinkEndChild( element );



	return doc.SaveFile(lpFileName);
}
开发者ID:telnykha,项目名称:VideoA,代码行数:60,代码来源:vautils.cpp

示例5: Save

void User::Save(bool force) {
  if (!force) {
    // If no save operation is scheduled, exit now
    if (!scheduledSaveTimer_) return;
    if (!scheduledSaveTimer_->IsRunning()) return;
  }

  settings_->Save();
  wxGetApp().GetPluginManager()->Save();

  TiXmlDocument doc;
  doc.LinkEndChild(new TiXmlDeclaration("1.0", "UTF-8", ""));

  TiXmlElement* xmlRoot = new TiXmlElement("FolderItems");
  xmlRoot->SetAttribute("version", "1.0");
  doc.LinkEndChild(xmlRoot);

  for (int i = 0; i < autoAddExclusions_.size(); i++) {
    XmlUtil::AppendTextElement(xmlRoot, "ExcludedPath", autoAddExclusions_[i]);
  }

  FolderItemVector folderItems = rootFolderItem_->GetChildren();
  for (int i = 0; i < folderItems.size(); i++) {
    FolderItem* folderItem = folderItems.at(i);
    xmlRoot->LinkEndChild(folderItem->ToXml());   
  }

  FilePaths::CreateSettingsDirectory();
  bool saved = doc.SaveFile(FilePaths::GetFolderItemsFile().mb_str());
  if (!saved) ELOG(_T("Could not save file"));
}
开发者ID:DocWhoChat,项目名称:appetizer,代码行数:31,代码来源:User.cpp

示例6: SaveRects

/*
	Функция сохраняет массив прямоугольников в xml файл out_r.xml
	параметры w,h предназначены для сохранения в относительных координатах
*/
void SaveRects(int w, int h)
{
	double value = 0;
	TiXmlElement* element = new TiXmlElement("Rects");
	for (int i = 0; i < g_rects_count; i++)
	{
		TiXmlElement* e = new TiXmlElement("rect");
		value = 100.*g_rects[i].x / (double)w;
		e->SetDoubleAttribute("x", value);
		value = 100.*g_rects[i].y / (double)h;
		e->SetDoubleAttribute("y", value);
		value = 100.*g_rects[i].width / (double)w;
		e->SetDoubleAttribute("w", value);
		value = 100.*g_rects[i].height / (double)h;
		e->SetDoubleAttribute("h", value);
		element->LinkEndChild(e);
	}

    TiXmlDocument doc;
    TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );
    doc.LinkEndChild( decl );
	doc.LinkEndChild( element );

	doc.SaveFile("out_r.xml");
}
开发者ID:telnykha,项目名称:VideoA,代码行数:29,代码来源:test_recorder.cpp

示例7: SaveSystemsetXml

void SaveSystemsetXml(const char *path, const t_SystemSet *systemSet) {
	char max_speed[16];
	char before_second[16];
	char after_second[16];
	char cal_before_second[16];
	char cal_after_second[16];

	TiXmlDocument *doc = new TiXmlDocument();
	TiXmlDeclaration *declar = new TiXmlDeclaration( "1.0", "UTF-8", "" );
	TiXmlElement *root = new TiXmlElement("SystemSet");
	doc->LinkEndChild(declar);
	doc->LinkEndChild(root);
	sprintf(max_speed, "%d", systemSet->m_max_speed);
	sprintf(before_second, "%d", systemSet->m_before_second);
	sprintf(after_second, "%d", systemSet->m_after_second);
	sprintf(cal_before_second, "%d", systemSet->m_cal_before_second);
	sprintf(cal_after_second, "%d", systemSet->m_cal_after_second);
	root->SetAttribute("MaxSpeed", max_speed);
	root->SetAttribute("BeforeSecond", before_second);
	root->SetAttribute("AfterSecond", after_second);
	root->SetAttribute("CalBeforeSecond", cal_before_second);
	root->SetAttribute("CalAfterSecond", cal_after_second);
	doc->SaveFile(path);
	delete doc;
}
开发者ID:SangYang,项目名称:GeneralFeatures,代码行数:25,代码来源:xml_file.cpp

示例8: CreateResponXML

void CCardProcess::CreateResponXML(int nID, const char *szResult, char *RetXML)
{
	TiXmlDocument *XmlDoc;
	TiXmlElement *RootElement;
	TiXmlElement *Segment;
	TiXmlDeclaration HeadDec;
	TiXmlPrinter Printer;

	// 创建XML文档
	XmlDoc = new TiXmlDocument();

	// 增加XML的头部说明
	HeadDec.Parse("<?xml version=\"1.0\" encoding=\"gb2312\" ?>", 0, TIXML_ENCODING_UNKNOWN);
	XmlDoc->LinkEndChild(&HeadDec);

	RootElement = new TiXmlElement("CardProcess");
	Segment = new TiXmlElement("ReturnInfo");
	Segment->SetAttribute("ID", nID);
	Segment->SetAttribute("Desc", szResult);

	RootElement->LinkEndChild(Segment);
	XmlDoc->LinkEndChild(RootElement);

	XmlDoc->Accept(&Printer);
	strcpy(RetXML, Printer.CStr());

}
开发者ID:modeyang,项目名称:CardProject,代码行数:27,代码来源:CardProcess.cpp

示例9: TiXmlDeclaration

bool mitk::TransferFunctionPropertySerializer::SerializeTransferFunction( const char * filename, TransferFunction::Pointer tf )
{
  TransferFunctionPropertySerializer::Pointer tfps=TransferFunctionPropertySerializer::New();
  tfps->SetProperty( TransferFunctionProperty::New( tf ) );
  TiXmlElement* s=tfps->Serialize();
   
  if(!s)
  {
    MITK_ERROR << "cant serialize transfer function";
    return false;
  }
   
  TiXmlDocument document;
  TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "UTF-8", "" ); // TODO what to write here? encoding? standalone would mean that we provide a DTD somewhere...
  document.LinkEndChild( decl );

  TiXmlElement* version = new TiXmlElement("Version");
  version->SetAttribute("TransferfunctionVersion",  1 );

  document.LinkEndChild(version);
  document.LinkEndChild(s);
  
  if ( !document.SaveFile( filename ) )
  {
    MITK_ERROR << "Could not write scene to " << filename << "\nTinyXML reports '" << document.ErrorDesc() << "'";
    return false;
  }
  return true;
}
开发者ID:test-fd301,项目名称:MITK,代码行数:29,代码来源:mitkTransferFunctionPropertySerializer.cpp

示例10: writeXMLFile

void MontagingToTraceEditorXMLConverter::writeXMLFile()
{
	TiXmlDocument doc;
	TiXmlDeclaration* decl = new TiXmlDeclaration("1.0", "", "");
	doc.LinkEndChild(decl);

	TiXmlElement* root = new TiXmlElement("Source");
	doc.LinkEndChild(root);

	std::vector<ImageTransformData*>::iterator image_transforms_data_iter;

	int counter = 0;
	for (image_transforms_data_iter = image_transforms_data.begin(); image_transforms_data_iter != image_transforms_data.end(); image_transforms_data_iter++)
	{
		TiXmlElement *File = new TiXmlElement("File");
		root->LinkEndChild(File);

		ImageTransformData *image_transform = *image_transforms_data_iter;

		File->SetDoubleAttribute("tX", -1.0 * (*image_transforms_data_iter)->gettX());
		File->SetDoubleAttribute("tY", -1.0 * (*image_transforms_data_iter)->gettY());
		File->SetDoubleAttribute("tZ", -1.0 * (*image_transforms_data_iter)->gettZ());
		File->SetAttribute("FileName", (*image_transforms_data_iter)->getFileName());
		File->SetAttribute("Type", "Image");
	}

	doc.SaveFile("project.xml");
}
开发者ID:Pandolph,项目名称:farsight,代码行数:28,代码来源:MontagingToTraceEditorXMLConverter.cpp

示例11: SaveXML

bool MultiMarker::SaveXML(const char* fname) {
	TiXmlDocument document;
	document.LinkEndChild(new TiXmlDeclaration("1.0", "UTF-8", "no"));
	document.LinkEndChild(new TiXmlElement("multimarker"));
	TiXmlElement *xml_root = document.RootElement();

	int n_markers = marker_indices.size();
	xml_root->SetAttribute("markers", n_markers);

	for(int i = 0; i < n_markers; ++i) {
		TiXmlElement *xml_marker = new TiXmlElement("marker");
		xml_root->LinkEndChild(xml_marker);

		xml_marker->SetAttribute("index", marker_indices[i]);
		xml_marker->SetAttribute("status", marker_status[i]);

		for(int j = 0; j < 4; ++j) {
			TiXmlElement *xml_corner = new TiXmlElement("corner");
			xml_marker->LinkEndChild(xml_corner);
			CvPoint3D64f X = pointcloud[pointcloud_index(marker_indices[i], j)];
			xml_corner->SetDoubleAttribute("x", X.x);
			xml_corner->SetDoubleAttribute("y", X.y);
			xml_corner->SetDoubleAttribute("z", X.z);
		}
	}
	return document.SaveFile(fname);
}
开发者ID:130s,项目名称:ar_track_alvar,代码行数:27,代码来源:MultiMarker.cpp

示例12: TiXmlDeclaration

/*! Writes the entire interface to a file in the following order:
	- the size of the eg space
	- the size of the dof space
	- all eigengrasps
	- the origin
	Seems not to be compatible with the readFromFile fucntion
	of this class.
*/
int
EigenGraspInterface::writeToFile(const char *filename)
{
	TiXmlDocument doc;  
 	TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );  
	doc.LinkEndChild( decl );  
 
	TiXmlElement * root = new TiXmlElement( "EigenGrasps" );  
	root->SetAttribute("dimensions", mRobot->getNumDOF());
	doc.LinkEndChild( root );  

	TiXmlElement * ep;
	for (int i=0; i<eSize; i++) {
	    	ep= new TiXmlElement("EG");
		mGrasps[i]->writeToFile(ep);
		root->LinkEndChild(ep);
		
	}
	//TODO Should ouput norm here
    	ep = new TiXmlElement("ORIGIN");
	mOrigin->writeToFile(ep);
	root->LinkEndChild(ep);

	doc.SaveFile(filename);

	return 1;
}
开发者ID:GraspControl,项目名称:graspit,代码行数:35,代码来源:eigenGrasp.cpp

示例13: createXMLFile

// create new xml file
bool CCUserDefault::createXMLFile()
{
	bool bRet = false;
	// ?¡§¨°?¨°???TiXmlDocument¨¤¨¤????   
    TiXmlDocument *pDoc = new TiXmlDocument;  
    if (NULL==pDoc)  
    {  
        return false;  
    }  
	TiXmlDeclaration *pDeclaration = new TiXmlDeclaration("1.0","","");  
	if (NULL==pDeclaration)  
	{  
		return false;  
	}  
	pDoc->LinkEndChild(pDeclaration); 
	// ¨¦¨²3¨¦¨°????¨´?¨²¦Ì?¡êoMyApp  
	TiXmlElement *pRootEle = new TiXmlElement(USERDEFAULT_ROOT_NAME);  
	if (NULL==pRootEle)  
	{  
		return false;  
	}  
	pDoc->LinkEndChild(pRootEle);  
	bRet = pDoc->SaveFile(m_wsFilePath.c_str());

	if(pDoc)
	{
		delete pDoc;
	}

	return bRet;
}
开发者ID:ccjimmy,项目名称:TweeJump4wp8,代码行数:32,代码来源:CCUserDefault.cpp

示例14: Save

void dBone::Save(const char* fileName, const dList<dBone*>& list)
{
	TiXmlText* header;
	TiXmlElement *root;

	TiXmlDeclaration* decl;

	TiXmlDocument out (fileName);
	decl = new TiXmlDeclaration( "1.0", "", "" );
	out.LinkEndChild( decl );

	root = new TiXmlElement( "root" );
	out.LinkEndChild(root);

	header = new TiXmlText (XML_HEADER);
	root->LinkEndChild(header);
	for (dList<dBone*>::dListNode* node = list.GetFirst(); node; node = node->GetNext()) {
		int stack;
		TiXmlElement *skeleton;
		const dBone* nodeArray[1024];

		skeleton = new TiXmlElement( "skeleton" );

		stack = 1;
		nodeArray[0] = node->GetInfo();
		while (stack) {
			const char* name;

			const dBone* node;
			TiXmlElement* xmlNode;

			stack --;
			node = nodeArray[stack];

			name = node->GetName();

			xmlNode = new TiXmlElement( "bone" );
			skeleton->LinkEndChild(xmlNode);

			xmlNode->SetAttribute("name", name);
			if (node->GetParent()) {
				const char* parentName;
				parentName = node->GetParent()->GetName();
				xmlNode->SetAttribute("parent", parentName);
			}
			xmlNode->SetAttribute("boneID", node->GetBoneID());

			char matrixBuffer[512];
			dModel::FloatsToString (matrixBuffer, &node->m_localMatrix[0][0], 16);
			xmlNode->SetAttribute("matrix", matrixBuffer);
			for (node = node->GetChild(); node; node = node->GetSibling()) {
				nodeArray[stack] = node;
				stack ++;
			}
		}
		root->LinkEndChild(skeleton);
	}

	out.SaveFile (fileName);
}
开发者ID:Zarius,项目名称:pseudoform,代码行数:60,代码来源:dBone.cpp

示例15: creatXml

void creatXml(char *name, char *number, char *text, char *dstime)
{

	
	strcpy( NAME[num++],name);//???????????

	string n = name;
	TiXmlDocument *myDocument = new TiXmlDocument(n.c_str());        //创建一个根结点
	TiXmlDeclaration *pDeclaration = new TiXmlDeclaration("1.0", "utf-8", "");   //创建xml文件头
	myDocument->LinkEndChild(pDeclaration);           //加入文件头
	time_t tm;
	
	TiXmlElement *Contacts = new TiXmlElement(n.c_str());   //创建一个节点
	TiXmlText *Contactstxt = new TiXmlText(text);
	Contacts->LinkEndChild(Contactstxt);
	Contacts->SetAttribute("Number", number);             //创建节点的一个属性IP
	Contacts->SetAttribute("Timing", dstime);      //是否定时 
	Contacts->SetAttribute("Name", name);
	Contacts->SetAttribute("Date", time(&tm));//传入时间
	myDocument->LinkEndChild(Contacts);            //加入节点

	myDocument->SaveFile();   //保存文件????如何用特定名字保存!
	delete myDocument;
	myDocument = NULL;
}
开发者ID:fine1x,项目名称:Project2,代码行数:25,代码来源:源.cpp


注:本文中的TiXmlDocument::LinkEndChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。