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


C++ TiXmlElement::InsertEndChild方法代码示例

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


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

示例1: writeAnimation

    //---------------------------------------------------------------------
    void XMLSkeletonSerializer::writeAnimation(TiXmlElement* animsNode, 
        const Animation* anim)
    {
        TiXmlElement* animNode = 
            animsNode->InsertEndChild(TiXmlElement("animation"))->ToElement();

        animNode->SetAttribute("name", anim->getName());
        animNode->SetAttribute("length", StringConverter::toString(anim->getLength()));
		
		// Optional base keyframe information
		if (anim->getUseBaseKeyFrame())
		{
			TiXmlElement* baseInfoNode = 
				animNode->InsertEndChild(TiXmlElement("baseinfo"))->ToElement();
			baseInfoNode->SetAttribute("baseanimationname", anim->getBaseKeyFrameAnimationName());
			baseInfoNode->SetAttribute("basekeyframetime", StringConverter::toString(anim->getBaseKeyFrameTime()));
		}

        // Write all tracks
        TiXmlElement* tracksNode = 
            animNode->InsertEndChild(TiXmlElement("tracks"))->ToElement();

        Animation::NodeTrackIterator trackIt = anim->getNodeTrackIterator();
        while (trackIt.hasMoreElements())
        {
            writeAnimationTrack(tracksNode, trackIt.getNext());
        }

    }
开发者ID:redkaras,项目名称:Demi3D,代码行数:30,代码来源:OgreXMLSkeletonSerializer.cpp

示例2: exportDotScene

//-----------------------------------------------------------------------------------------
TiXmlElement* CParticleEditor::exportDotScene(TiXmlElement *pParent)
{
    TiXmlElement *pNode = pParent->InsertEndChild(TiXmlElement("node"))->ToElement();

    // node properties
    pNode->SetAttribute("name", mName->get().c_str());
    pNode->SetAttribute("id", Ogre::StringConverter::toString(mObjectID->get()).c_str());
    // position
    TiXmlElement *pPosition = pNode->InsertEndChild(TiXmlElement("position"))->ToElement();
    pPosition->SetAttribute("x", Ogre::StringConverter::toString(mPosition->get().x).c_str());
    pPosition->SetAttribute("y", Ogre::StringConverter::toString(mPosition->get().y).c_str());
    pPosition->SetAttribute("z", Ogre::StringConverter::toString(mPosition->get().z).c_str());
    // rotation
    TiXmlElement *pRotation = pNode->InsertEndChild(TiXmlElement("rotation"))->ToElement();
    pRotation->SetAttribute("qw", Ogre::StringConverter::toString(mOrientation->get().w).c_str());
    pRotation->SetAttribute("qx", Ogre::StringConverter::toString(mOrientation->get().x).c_str());
    pRotation->SetAttribute("qy", Ogre::StringConverter::toString(mOrientation->get().y).c_str());
    pRotation->SetAttribute("qz", Ogre::StringConverter::toString(mOrientation->get().z).c_str());
    // scale
    TiXmlElement *pScale = pNode->InsertEndChild(TiXmlElement("scale"))->ToElement();
    pScale->SetAttribute("x", Ogre::StringConverter::toString(mScale->get().x).c_str());
    pScale->SetAttribute("y", Ogre::StringConverter::toString(mScale->get().y).c_str());
    pScale->SetAttribute("z", Ogre::StringConverter::toString(mScale->get().z).c_str());

    TiXmlElement *pParticleSystem = pNode->InsertEndChild(TiXmlElement("particleSystem"))->ToElement();
    pParticleSystem->SetAttribute("name", mName->get().c_str());
    pParticleSystem->SetAttribute("script", mParticleSystem->get().c_str());

    return pNode;
}
开发者ID:EternalWind,项目名称:Ogitor-Facade,代码行数:31,代码来源:ParticleEditor.cpp

示例3: GetSpecProcElement

	TiXmlElement* GetSpecProcElement(SpecProc *sProc)
	{
		TiXmlElement *sProcEl = new TiXmlElement("HProc");
		sProcEl->SetAttribute("Qual", sProc->GetParentModule()->Name.c_str());
		sProcEl->SetAttribute("Name", sProc->GetCPPProcName(false).c_str());
		sProcEl->SetAttribute("UID", sProc->num);
		if (sProc->returnType)
			sProcEl->SetAttribute("ReturnType", sProc->returnType->GetCPPTypeName(false).c_str());

		// записываем спец-е параметры обработчика
		vector<Parameter*>::const_iterator ci;
		for (ci = sProc->commonParams.begin(); ci != sProc->commonParams.end(); ci++)
		{
			TiXmlElement *sParam = GetSParamElement(static_cast<Parameter*>(*ci));
			sProcEl->InsertEndChild(*sParam);
		}

		// записываем форм-е параметры обработчика
		for (ci = sProc->formalParams.begin(); ci != sProc->formalParams.end(); ci++)
		{
			TiXmlElement *fParam = GetFormalParamElement(static_cast<Parameter*>(*ci));
			sProcEl->InsertEndChild(*fParam);
		}

		return sProcEl;
	}
开发者ID:kpdev42,项目名称:Kaleidoscope,代码行数:26,代码来源:GenProcsManager.cpp

示例4: SetXmlValue

void COptions::SetXmlValue(unsigned int nID, wxString value)
{
	if (!m_pXmlFile)
		return;

	// No checks are made about the validity of the value, that's done in SetOption

	char *utf8 = ConvUTF8(value);
	if (!utf8)
		return;

	TiXmlElement *settings = m_pXmlFile->GetElement()->FirstChildElement("Settings");
	if (!settings)
	{
		TiXmlNode *node = m_pXmlFile->GetElement()->InsertEndChild(TiXmlElement("Settings"));
		if (!node)
		{
			delete [] utf8;
			return;
		}
		settings = node->ToElement();
		if (!settings)
		{
			delete [] utf8;
			return;
		}
	}
	else
	{
		TiXmlNode *node = 0;
		while ((node = settings->IterateChildren("Setting", node)))
		{
			TiXmlElement *setting = node->ToElement();
			if (!setting)
				continue;

			const char *attribute = setting->Attribute("name");
			if (!attribute)
				continue;
			if (strcmp(attribute, options[nID].name))
				continue;

			setting->RemoveAttribute("type");
			setting->Clear();
			setting->SetAttribute("type", (options[nID].type == string) ? "string" : "number");
			setting->InsertEndChild(TiXmlText(utf8));

			delete [] utf8;
			return;
		}
	}
	wxASSERT(options[nID].name[0]);
	TiXmlElement setting("Setting");
	setting.SetAttribute("name", options[nID].name);
	setting.SetAttribute("type", (options[nID].type == string) ? "string" : "number");
	setting.InsertEndChild(TiXmlText(utf8));
	settings->InsertEndChild(setting);

	delete [] utf8;
}
开发者ID:ErichKrause,项目名称:filezilla,代码行数:60,代码来源:Options.cpp

示例5: writeSkeleton

    //---------------------------------------------------------------------
    void XMLSkeletonSerializer::writeSkeleton(const Skeleton* pSkel)
    {
        TiXmlElement* rootNode = mXMLDoc->RootElement();

        TiXmlElement* bonesElem = 
            rootNode->InsertEndChild(TiXmlElement("bones"))->ToElement();

        unsigned short numBones = pSkel->getNumBones();
		LogManager::getSingleton().logMessage("There are " + StringConverter::toString(numBones) + " bones.");
        unsigned short i;
        for (i = 0; i < numBones; ++i)
        {
			LogManager::getSingleton().logMessage("   Exporting Bone number " + StringConverter::toString(i));
            Bone* pBone = pSkel->getBone(i);
            writeBone(bonesElem, pBone);
        }

        // Write parents
        TiXmlElement* hierElem = 
            rootNode->InsertEndChild(TiXmlElement("bonehierarchy"))->ToElement();
        for (i = 0; i < numBones; ++i)
        {
            Bone* pBone = pSkel->getBone(i);
			String name = pBone->getName() ;

			if ((pBone->getParent())!=NULL) // root bone
            {
                Bone* pParent = (Bone*)pBone->getParent();
                writeBoneParent(hierElem, name, pParent->getName());
            }
        }


    }
开发者ID:Strongc,项目名称:game-ui-solution,代码行数:35,代码来源:OgreXMLSkeletonSerializer.cpp

示例6: name

/* virtual */ opera_update_checker::status::Status OAUCRequestImpl::AddProductUpdatePart(const UpdateDataProvider& provider)
{
  try
  {
    if (!document_.RootElement())
    {
      document_.Parse(update_request_root);
      if (document_.Error())
        return opera_update_checker::status::StatusCode::FAILED;
    }

    TiXmlDocument temp;

    TIXML_STRING name(provider.GetProductName() ? provider.GetProductName() : "");
    TIXML_STRING encoded_name;
    TIXML_STRING ver(provider.GetProductVersion() ? provider.GetProductVersion() : "");
    TIXML_STRING encoded_ver;
    TIXML_STRING lang(provider.GetProductLanguage() ? provider.GetProductLanguage() : "");
    TIXML_STRING encoded_lang;
    document_.EncodeString(name, &encoded_name);
    document_.EncodeString(ver, &encoded_ver);
    document_.EncodeString(lang, &encoded_lang);

    sprintf(shared_work_buffer,
            update_product_part_template,
            encoded_name.c_str() ? encoded_name.c_str() : "",
            encoded_ver.c_str() ? encoded_ver.c_str() : "",
            encoded_lang.c_str() ? encoded_lang.c_str() : "");

      temp.Parse(shared_work_buffer);
      if (temp.Error())
        return opera_update_checker::status::StatusCode::FAILED;

      OAUC_ASSERT(document_.RootElement() && document_.RootElement()->FirstChildElement());
      TiXmlElement* child = document_.RootElement()->FirstChildElement();
      while (opera_update_checker::system_utils::SystemUtils::strnicmp(child->Value(), "product", 7) != 0)
      {
        child = child->NextSiblingElement();
        OAUC_ASSERT(child);
      }

      TiXmlElement* elm = temp.RootElement();
      do
      {
        child->InsertEndChild(*elm);
        elm = elm->NextSiblingElement();
      } while (elm);

      if (TiXmlElement* products = product_res_document_.RootElement())
        child->InsertEndChild(*products);
  }
  catch (...)
  {
    return opera_update_checker::status::StatusCode::OOM;
  }

  return opera_update_checker::status::StatusCode::OK;
}
开发者ID:prestocore,项目名称:browser,代码行数:58,代码来源:protocolimpl.cpp

示例7: WriteConfiguration

void wxsProject::WriteConfiguration(TiXmlElement* element)
{
    TiXmlElement* SmithElement = element->FirstChildElement("wxsmith");

    if ( !m_GUI && m_Resources.empty() && m_UnknownConfig.NoChildren() && m_UnknownResources.NoChildren() )
    {
        // Nothing to write
        if ( SmithElement )
        {
            element->RemoveChild(SmithElement);
        }
        return;
    }

    if ( !SmithElement )
    {
		SmithElement = element->InsertEndChild(TiXmlElement("wxsmith"))->ToElement();
    }
	SmithElement->Clear();
    SmithElement->SetAttribute("version",CurrentVersionStr);

    // saving GUI item
    if ( m_GUI )
    {
        TiXmlElement* GUIElement = SmithElement->InsertEndChild(TiXmlElement("gui"))->ToElement();
        GUIElement->SetAttribute("name",cbU2C(m_GUI->GetName()));
        m_GUI->WriteConfig(GUIElement);
    }

    // saving resources
    if ( !m_Resources.empty() || !m_UnknownResources.NoChildren() )
    {
        TiXmlElement* ResElement = SmithElement->InsertEndChild(TiXmlElement("resources"))->ToElement();
        size_t Count = m_Resources.Count();
        for ( size_t i=0; i<Count; i++ )
        {
            const wxString& Name = m_Resources[i]->GetResourceName();
            const wxString& Type = m_Resources[i]->GetResourceType();
            TiXmlElement* Element = ResElement->InsertEndChild(TiXmlElement(cbU2C(Type)))->ToElement();
            // TODO: Check value returned from WriteConfig
            m_Resources[i]->WriteConfig(Element);
            Element->SetAttribute("name",cbU2C(Name));
        }

        // Saving all unknown resources
        for ( TiXmlNode* Node = m_UnknownResources.FirstChild(); Node; Node=Node->NextSibling() )
        {
            SmithElement->InsertEndChild(*Node);
        }
    }

    // Saving all unknown configuration nodes
    for ( TiXmlNode* Node = m_UnknownConfig.FirstChild(); Node; Node=Node->NextSibling() )
    {
        SmithElement->InsertEndChild(*Node);
    }

}
开发者ID:469306621,项目名称:Languages,代码行数:58,代码来源:wxsproject.cpp

示例8: exportDotScene

//----------------------------------------------------------------------------------------
TiXmlElement* PortalEditor::exportDotScene(TiXmlElement *pParent)
{
    TiXmlElement *pNode = pParent->InsertEndChild(TiXmlElement("portal"))->ToElement();

    // node properties
    pNode->SetAttribute("name", mName->get().c_str());
    pNode->SetAttribute("id", Ogre::StringConverter::toString(mObjectID->get()).c_str());
    // position
    TiXmlElement *pPosition = pNode->InsertEndChild(TiXmlElement("position"))->ToElement();
    pPosition->SetAttribute("x", Ogre::StringConverter::toString(mPosition->get().x).c_str());
    pPosition->SetAttribute("y", Ogre::StringConverter::toString(mPosition->get().y).c_str());
    pPosition->SetAttribute("z", Ogre::StringConverter::toString(mPosition->get().z).c_str());
    // rotation
    TiXmlElement *pRotation = pNode->InsertEndChild(TiXmlElement("rotation"))->ToElement();
    pRotation->SetAttribute("qw", Ogre::StringConverter::toString(mOrientation->get().w).c_str());
    pRotation->SetAttribute("qx", Ogre::StringConverter::toString(mOrientation->get().x).c_str());
    pRotation->SetAttribute("qy", Ogre::StringConverter::toString(mOrientation->get().y).c_str());
    pRotation->SetAttribute("qz", Ogre::StringConverter::toString(mOrientation->get().z).c_str());
    // scale
    TiXmlElement *pScale = pNode->InsertEndChild(TiXmlElement("scale"))->ToElement();
    pScale->SetAttribute("x", Ogre::StringConverter::toString(mScale->get().x).c_str());
    pScale->SetAttribute("y", Ogre::StringConverter::toString(mScale->get().y).c_str());
    pScale->SetAttribute("z", Ogre::StringConverter::toString(mScale->get().z).c_str());

    //*coords of portal corners*
    //(use that instead of width/height, thus this format can be used for
    //more fully implemented PCZSM editors)
    TiXmlElement *pCorners = pNode->InsertEndChild(TiXmlElement("corners"))->ToElement();

    TiXmlElement *pCorner0 = pCorners->InsertEndChild(TiXmlElement("corner0"))->ToElement();
    pCorner0->SetAttribute("x", Ogre::StringConverter::toString(-(mWidth->get())/2).c_str());
    pCorner0->SetAttribute("y", Ogre::StringConverter::toString((mHeight->get())/2).c_str());
    pCorner0->SetAttribute("z", "0.0");

    TiXmlElement *pCorner1 = pCorners->InsertEndChild(TiXmlElement("corner1"))->ToElement();
    pCorner1->SetAttribute("x", Ogre::StringConverter::toString((mWidth->get())/2).c_str());
    pCorner1->SetAttribute("y", Ogre::StringConverter::toString((mHeight->get())/2).c_str());
    pCorner1->SetAttribute("z", "0.0");

    TiXmlElement *pCorner2 = pCorners->InsertEndChild(TiXmlElement("corner2"))->ToElement();
    pCorner2->SetAttribute("x", Ogre::StringConverter::toString((mWidth->get())/2).c_str());
    pCorner2->SetAttribute("y", Ogre::StringConverter::toString(-(mHeight->get())/2).c_str());
    pCorner2->SetAttribute("z", "0.0");

    TiXmlElement *pCorner3 = pCorners->InsertEndChild(TiXmlElement("corner3"))->ToElement();
    pCorner3->SetAttribute("x", Ogre::StringConverter::toString(-(mWidth->get())/2).c_str());
    pCorner3->SetAttribute("y", Ogre::StringConverter::toString(-(mHeight->get())/2).c_str());
    pCorner3->SetAttribute("z", "0.0");

    //*destination*
    TiXmlElement *pDestination = pNode->InsertEndChild(TiXmlElement("destination"))->ToElement();
    if(mConnected)
    {
        pDestination->SetAttribute("zone", mConnected->mParentZone->getName().c_str());
        pDestination->SetAttribute("portal",mConnected->getName().c_str());
    }

    return pNode;
}
开发者ID:xubingyue,项目名称:Ogitor,代码行数:60,代码来源:PortalEditor.cpp

示例9:

bool CSPrimBox::Write2XML(TiXmlElement &elem, bool parameterised)
{
    CSPrimitives::Write2XML(elem,parameterised);

    TiXmlElement P1("P1");
    m_Coords[0].Write2XML(&P1,parameterised);
    elem.InsertEndChild(P1);

    TiXmlElement P2("P2");
    m_Coords[1].Write2XML(&P2,parameterised);
    elem.InsertEndChild(P2);
    return true;
}
开发者ID:koendv,项目名称:CSXCAD,代码行数:13,代码来源:CSPrimBox.cpp

示例10: RebuildXrcFile

bool wxsItemResData::RebuildXrcFile()
{
    // First - opening file
    TiXmlDocument Doc;
    TiXmlElement* Resources = nullptr;
    TiXmlElement* Object = nullptr;

    if ( TinyXML::LoadDocument(m_XrcFileName,&Doc) )
    {
        Resources = Doc.FirstChildElement("resource");
    }

    if ( !Resources )
    {
        Doc.Clear();
        Doc.InsertEndChild(TiXmlDeclaration("1.0","utf-8",""));
        Resources = Doc.InsertEndChild(TiXmlElement("resource"))->ToElement();
        Resources->SetAttribute("xmlns","http://www.wxwidgets.org/wxxrc");
    }

    // Searching for object representing this resource
    for ( Object = Resources->FirstChildElement("object"); Object; Object = Object->NextSiblingElement("object") )
    {
        if ( cbC2U(Object->Attribute("name")) == m_ClassName )
        {
            Object->Clear();
            while ( Object->FirstAttribute() )
            {
                Object->RemoveAttribute(Object->FirstAttribute()->Name());
            }
            break;
        }
    }

    if ( !Object )
    {
        Object = Resources->InsertEndChild(TiXmlElement("object"))->ToElement();
    }

    // The only things left are: to dump item into object ...
    m_RootItem->XmlWrite(Object,true,false);
    Object->SetAttribute("name",cbU2C(m_ClassName));
    for ( int i=0; i<GetToolsCount(); i++ )
    {
        TiXmlElement* ToolElement = Object->InsertEndChild(TiXmlElement("object"))->ToElement();
        m_Tools[i]->XmlWrite(ToolElement,true,false);
    }

    // ... and save back the file
    return TinyXML::SaveDocument(m_XrcFileName,&Doc);
}
开发者ID:WinterMute,项目名称:codeblocks_sf,代码行数:51,代码来源:wxsitemresdata.cpp

示例11: saveProxyLastState

bool CRedisProxyCfg::saveProxyLastState(RedisProxy* proxy) {
    TiXmlElement* pRootNode = (TiXmlElement*)m_operateXmlPointer->get_rootElement();
    string nodeHash = "hash_mapping";
    TiXmlElement* pOldHashMap;
    if (GetNodePointerByName(pRootNode, nodeHash, pOldHashMap)) {
        pRootNode->RemoveChild(pOldHashMap);
    }
    TiXmlElement hashMappingNode("hash_mapping");
    for (int i = 0; i < proxy->slotCount(); ++i) {
        TiXmlElement hashNode("hash");
        hashNode.SetAttribute("value", i);
        hashNode.SetAttribute("group_name", proxy->groupBySlot(i)->groupName());
        hashMappingNode.InsertEndChild(hashNode);
    }
    pRootNode->InsertEndChild(hashMappingNode);

    // key mapping
    string nodeKey = "key_mapping";
    TiXmlElement* pKey;
    if (GetNodePointerByName(pRootNode, nodeKey, pKey)) {
        pRootNode->RemoveChild(pKey);
    }
    TiXmlElement keyMappingNode("key_mapping");

    StringMap<RedisServantGroup*>& keyMapping = proxy->keyMapping();
    StringMap<RedisServantGroup*>::iterator it = keyMapping.begin();
    for (; it != keyMapping.end(); ++it) {
        String key = it->first;
        TiXmlElement keyNode("key");
        keyNode.SetAttribute("key_name", key.data());
        RedisServantGroup* group = it->second;
        if (group != NULL) {
            keyNode.SetAttribute("group_name", group->groupName());
        }
        keyMappingNode.InsertEndChild(keyNode);
    }
    pRootNode->InsertEndChild(keyMappingNode);

    // add time
    time_t now = time(NULL);
    char fileName[512];
    struct tm* current_time = localtime(&now);
    sprintf(fileName,"onecache%d%02d%02d%02d.xml",
        current_time->tm_year + 1900,
        current_time->tm_mon + 1,
        current_time->tm_mday,
        current_time->tm_hour);

    bool ok = m_operateXmlPointer->m_docPointer->SaveFile(fileName);
    return ok;
}
开发者ID:SimpleDays,项目名称:onecache,代码行数:51,代码来源:redis-proxy-config.cpp

示例12: exportPoses

void XMLModelDefinitionSerializer::exportPoses(ModelDefinitionPtr modelDef, TiXmlElement& modelElem)
{
	if (modelDef->mPoseDefinitions.size()) {
		TiXmlElement elem("poses");

		for (PoseDefinitionStore::const_iterator I = modelDef->mPoseDefinitions.begin(); I != modelDef->mPoseDefinitions.end(); ++I) {
			TiXmlElement poseElem("pose");
			poseElem.SetAttribute("name", I->first.c_str());
			if (I->second.IgnoreEntityData) {
				poseElem.SetAttribute("ignoreEntityData", "true");
			}
			if (!I->second.Translate.isNaN()) {
				TiXmlElement translateElem("translate");
				XMLHelper::fillElementFromVector3(translateElem, I->second.Translate);
				poseElem.InsertEndChild(translateElem);
			}
			if (!I->second.Rotate.isNaN()) {
				TiXmlElement rotateElem("rotate");
				XMLHelper::fillElementFromQuaternion(rotateElem, I->second.Rotate);
				poseElem.InsertEndChild(rotateElem);
			}

			elem.InsertEndChild(poseElem);
		}
		modelElem.InsertEndChild(elem);
	}
}
开发者ID:Chimangoo,项目名称:ember,代码行数:27,代码来源:XMLModelDefinitionSerializer.cpp

示例13: WriteToXml

void WriteToXml(string& strXml, vector<bool>& vecType,string& FileName)
{
	COriFileOperate oriFile(FileName);
	size_t nVecSize = vecType.size();
	if (strXml.find("chinese_simple") != -1)
	{
		for (size_t i=1;i<nVecSize;++i)
		{
			vecType[i] = false;
		}
	}
	char* szNumOrStrInfo = new char[nVecSize+1];
	for (size_t i = 0; i < nVecSize; i++)
	{
		if (vecType[i])
		{
			szNumOrStrInfo[i] = 'n';
		}
		else
		{
			szNumOrStrInfo[i] = 's';
		}
	}
	szNumOrStrInfo[nVecSize] = '\0';
	TiXmlDocument* pXmlDoc = new TiXmlDocument;
	pXmlDoc->InsertEndChild(TiXmlElement("config"));
	TiXmlNode* pXmlNode = pXmlDoc->FirstChild("config");
	pXmlNode->InsertEndChild(TiXmlElement("TableType"));
	TiXmlElement* pXmlElem = pXmlNode->FirstChildElement("TableType");
	pXmlElem->InsertEndChild(TiXmlText("S"));
	string str = szNumOrStrInfo;
	string str1 = oriFile.GetDataByRowCol(0,0);
	transform(str1.begin(),str1.end(),str1.begin(),toupper);
	for(uint32 i=1;i<=str.size();i++)
	{
		TiXmlElement* cxn = new TiXmlElement("Col");
		pXmlNode->LinkEndChild(cxn);
	//	cxn->SetAttribute("ColNum",i);
		if(str1!="NOTE:")
		{
			cxn->SetAttribute("Name",oriFile.GetDataByRowCol(0,i-1).c_str());
		}
		else
		{
			cxn->SetAttribute("Name",oriFile.GetDataByRowCol(1,i-1).c_str());
		}
		string ss;
		stringstream temp;
		temp<<szNumOrStrInfo[i-1];
		temp>>ss;
		cxn->SetAttribute("Type",ss);
	}

	pXmlDoc->SaveFile(strXml);

	delete pXmlDoc;
	pXmlDoc = NULL;
	delete[] szNumOrStrInfo;
	szNumOrStrInfo = NULL;
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:60,代码来源:MakeTxtXmlAuto.cpp

示例14: SetControlType

void ConfigManager::SetControlType(int controller, const char* type)
{
	TiXmlHandle docHandle( config_file );
    TiXmlElement* player = docHandle.FirstChild( "Balder" ).FirstChild( "Player" ).Element();
    TiXmlElement* lastPlayer = 0;
    while(player)
    {
    	lastPlayer = player;
    	int c;
    	int result = player->QueryIntAttribute("controller",&c);
    	if (TIXML_SUCCESS == result){
    		if (controller == c){
    			TiXmlHandle h(player);
    			TiXmlElement *controlEl = h.FirstChild("Control").Element();
    			if (!controlEl){
    				// first make sure the Control section exists
					controlEl = new TiXmlElement("Control");
					controlEl->SetAttribute("type", type);
    			}
    			else {controlEl->SetAttribute("type", type);}
    			return;
    		}
    	}
	    player=player->NextSiblingElement("Player");
    }
    // it appears that we did not find the player, must add it . .
    if (!lastPlayer) {
    	lastPlayer = docHandle.FirstChild("Balder").Element();
    }
    player = new TiXmlElement("Player");
    player->SetAttribute("controller", controller);
    player->InsertEndChild(*(new TiXmlElement("Control")));
    player->FirstChildElement("Control")->SetAttribute("type", type);
    docHandle.FirstChild("Balder").Element()->InsertAfterChild(lastPlayer, *player);
}
开发者ID:luqui,项目名称:balder2d,代码行数:35,代码来源:configmanager.cpp

示例15: main

int main()
{
// 	TiXmlDocument doc;
// 	doc.LoadFile("Configuration.xml");
// 	TiXmlHandle hXml(&doc);
// 	TiXmlElement xmlElement("ContourColor");
// 	TiXmlElement* pElement = hXml.FirstChildElement("DlgChain").ToElement();
// 	pElement->InsertEndChild(xmlElement);
// 	//doc.Print(stdout);
// 	//hXml.ToNode()->Print(stdout,0);
// 	hXml.Print(stdout,0);

	CXmlParser xmlParser("..\\bin\\Configuration\\Configuration.xml");
	//xmlParser.LoadFile("Configuration.xml");
	TiXmlElement element("ContourColor");
	TiXmlElement* pElement = xmlParser.FirstChild("DlgChain").ToElement();
	pElement->InsertEndChild(element);
	pElement = pElement->FirstChild("ContourColor")->ToElement();
	pElement->SetAttribute("edge",0xffffff);
	pElement->SetAttribute("mask",0xff00ff);
	pElement->SetAttribute("num",0x0000ff);
	xmlParser.SaveAs("Configuration1.xml");
	
	system("pause");
	return 0;
}
开发者ID:wumuzi520,项目名称:ForestProject,代码行数:26,代码来源:Main.cpp


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