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


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

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


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

示例1: GernerateXML

TiXmlElement* Vec3::GenerateOverridesXML( TiXmlElement* pResource ) const
   {
   TiXmlElement* pRetNode = GernerateXML();
   if( !std::strcmp( pRetNode->Attribute( "x" ), pResource->Attribute( "x" ) ) &&
       !std::strcmp( pRetNode->Attribute( "y" ), pResource->Attribute( "y" ) ) &&
       !std::strcmp( pRetNode->Attribute( "z" ), pResource->Attribute( "z" ) ) )
      {
      pRetNode->RemoveAttribute( "x" );
      pRetNode->RemoveAttribute( "y" );
      pRetNode->RemoveAttribute( "z" );
      }
   return pRetNode;
   }
开发者ID:scw000000,项目名称:Engine,代码行数:13,代码来源:Geometry.cpp

示例2: GenerateOverridesXML

TiXmlElement* Color::GenerateOverridesXML( TiXmlElement* pResource )
    {
    TiXmlElement* pRetNode = GenerateXML();
    if( !std::strcmp( pRetNode->Attribute( "r" ), pResource->Attribute( "r" ) ) &&
        !std::strcmp( pRetNode->Attribute( "g" ), pResource->Attribute( "g" ) ) &&
        !std::strcmp( pRetNode->Attribute( "b" ), pResource->Attribute( "b" ) ) &&
        !std::strcmp( pRetNode->Attribute( "a" ), pResource->Attribute( "a" ) ) )
       {
       pRetNode->RemoveAttribute( "r" );
       pRetNode->RemoveAttribute( "g" );
       pRetNode->RemoveAttribute( "b" );
       pRetNode->RemoveAttribute( "a" );
       }
    return pRetNode;
    }
开发者ID:scw000000,项目名称:Engine,代码行数:15,代码来源:Geometry.cpp

示例3: UIModify

void CALLBACK CUICommandHistory::UIModify(TiXmlNode* pNode)
{
	TiXmlElement* pElement = pNode->ToElement();
	CStringA strName = pElement->Attribute("myname");
	pElement->RemoveAttribute("myname");
	if(strName.IsEmpty())
		return;

	CPaintManagerUI* pManager = g_pMainFrame->GetActiveUIView()->GetPaintManager();
	CControlUI* pControl = pManager->FindControl(StringConvertor::Utf8ToWide(strName));
	TiXmlAttribute* pAttrib = pElement->FirstAttribute();
	if(pControl == NULL)
		return;

	while(pAttrib)
	{
		if(strcmp(pAttrib->Name(), "name") == 0)
		{
			pManager->ReapObjects(pControl);
			g_pClassView->RenameUITreeItem(pControl, StringConvertor::Utf8ToWide(pAttrib->Value()));
			pControl->SetAttribute(StringConvertor::Utf8ToWide(pAttrib->Name())
				, StringConvertor::Utf8ToWide(pAttrib->Value()));
			pManager->InitControls(pControl);
		}
		else
			pControl->SetAttribute(StringConvertor::Utf8ToWide(pAttrib->Name())
				, StringConvertor::Utf8ToWide(pAttrib->Value()));

		pAttrib = pAttrib->Next();
	}
	CControlUI* pParent = pControl->GetParent();
	if(pParent == NULL)
		pParent = pControl;
	pParent->SetPos(pParent->GetPos());
}
开发者ID:DayDayUpCQ,项目名称:misc,代码行数:35,代码来源:UICommandHistory.cpp

示例4: UIAdd

void CALLBACK CUICommandHistory::UIAdd(TiXmlNode* pNode)
{
	TiXmlElement* pElement = pNode->ToElement();
	CStringA strParentName = pElement->Attribute("parentname");
	pElement->RemoveAttribute("parentname");
	if(strParentName.IsEmpty())
		return;

	CUIDesignerView* pUIView = g_pMainFrame->GetActiveUIView();
	CPaintManagerUI* pManager = pUIView->GetPaintManager();
	CControlUI* pParentControl = pManager->FindControl(StringConvertor::Utf8ToWide(strParentName));
	if(pParentControl == NULL)
		return;

	TiXmlDocument xmlDoc;
	TiXmlDeclaration Declaration("1.0","utf-8","yes");
	xmlDoc.InsertEndChild(Declaration);
	TiXmlElement* pRootElem = new TiXmlElement("UIAdd");
	pRootElem->InsertEndChild(*pElement);
	xmlDoc.InsertEndChild(*pRootElem);
	TiXmlPrinter printer;
	xmlDoc.Accept(&printer);
	delete pRootElem;

	CDialogBuilder builder;
	CControlUI* pRoot=builder.Create(StringConvertor::Utf8ToWide(printer.CStr()), (UINT)0, NULL, pManager);
 	if(pRoot)
		pUIView->RedoUI(pRoot, pParentControl);
}
开发者ID:DayDayUpCQ,项目名称:misc,代码行数:29,代码来源:UICommandHistory.cpp

示例5: 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

示例6: RemoveAttributes

void csTinyXmlNode::RemoveAttributes ()
{
  TiXmlElement* element = node->ToElement ();
  if (element)
  {
    for (size_t i = 0; i < element->GetAttributeCount (); i++)
    {
      TiDocumentAttribute& attrib = element->GetAttribute (i);
      element->RemoveAttribute(attrib.Name ());
    }
  }
}
开发者ID:GameLemur,项目名称:Crystal-Space,代码行数:12,代码来源:xmltiny.cpp

示例7: RemoveAttribute

    void GD_EXTENSION_API RemoveAttribute(const std::string &refname, const std::string &property, RuntimeScene &scene)
    {
        TiXmlNode *refNode = RefManager::Get(&scene)->GetRef(refname);

        if(refNode)
        {
            TiXmlElement *refEle = refNode->ToElement();
            if(refEle)
            {
                refEle->RemoveAttribute(property.c_str());
            }
        }
    }
开发者ID:4ian,项目名称:GD-Extensions,代码行数:13,代码来源:AdvancedXMLTools.cpp

示例8: 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

示例9: removeAttribute

//---------------------------------------------------------
void ofxXmlSettings::removeAttribute(const string& tag, const string& attribute, int which){
	vector<string> tokens = tokenize(tag,":");
	TiXmlHandle tagHandle = storedHandle;
	for (int x = 0; x < (int)tokens.size(); x++) {
		if (x == 0)
			tagHandle = tagHandle.ChildElement(tokens.at(x), which);
		else
			tagHandle = tagHandle.FirstChildElement(tokens.at(x));
	}

	if (tagHandle.ToElement()) {
		TiXmlElement* elem = tagHandle.ToElement();
		elem->RemoveAttribute(attribute);
	}
}
开发者ID:AnnaKolla,项目名称:openFrameworks,代码行数:16,代码来源:ofxXmlSettings.cpp

示例10: RemoveAttribute

void csTinyXmlNode::RemoveAttribute (const csRef<iDocumentAttribute>& attribute)
{
  TiXmlElement* element = node->ToElement ();
  if (element)
  {
    for (size_t i = 0 ; i < element->GetAttributeCount (); i++)
    {
      TiDocumentAttribute& attrib = element->GetAttribute (i);
      if (strcmp (attribute->GetName(), attrib.Name ()) == 0)
      {
        element->RemoveAttribute(attrib.Name());
      }
    }
  }
}
开发者ID:GameLemur,项目名称:Crystal-Space,代码行数:15,代码来源:xmltiny.cpp

示例11:

int em::EmXml::ClearRootAttr()
{
	bool bUpdated = false;
	int iResult = 0;
	TiXmlElement *pElemRoot = m_pDoc->RootElement();
	if(pElemRoot == NULL)
	{
		return 0;
	}
	
	
	while(pElemRoot->FirstAttribute())
	{
		pElemRoot->RemoveAttribute(pElemRoot->FirstAttribute()->Name());
		bUpdated = true;
	}

	m_bUpdated = bUpdated;
	return iResult;
}
开发者ID:lidongqiang,项目名称:FWFactoryTool,代码行数:20,代码来源:EmXml.cpp

示例12: readSchoolXml

void readSchoolXml() 
{
	using namespace std;

	const char *xmlFile = "conf/school.xml";

	TiXmlDocument doc;
	if (!doc.LoadFile(xmlFile))
	{
		cout << "Load xml file failed.\t" << xmlFile << endl;
		return;
	}

	cout << "Load xml file OK." << endl;
	
	TiXmlDeclaration *decl = doc.FirstChild()->ToDeclaration();

	if (!decl)
	{
		cout << "decl is null.\n" << endl;
		return;
	}
	
	cout <<  decl->Encoding();
	cout <<  decl->Version();
	cout <<  decl->Standalone() << endl;



	TiXmlHandle docHandle(&doc);
	TiXmlElement *child 
		= docHandle.FirstChild("School").FirstChild("Class").Child("Student", 0).ToElement();

	for ( ; child != NULL; child = child->NextSiblingElement())
	{
		TiXmlAttribute *attr = child->FirstAttribute();

		for (; attr != NULL; attr = attr->Next())
		{
			cout << attr->Name() << " : " << attr->Value() << endl;
		}
		
		TiXmlElement *ct = child->FirstChildElement();
		for (; ct != NULL; ct = ct->NextSiblingElement())
		{
			char buf[1024] = {0};
			u2g(ct->GetText(), strlen(ct->GetText()), buf, sizeof(buf));
			cout << ct->Value() << " : " << buf << endl;
		}
		cout << "=====================================" << endl;
	}
	
	TiXmlElement *schl = doc.RootElement();
	const char *value_t =schl->Attribute("name");
	
	char buf[1024] = {0};
	if ( u2g(value_t, strlen(value_t), buf, sizeof(buf)) == -1) {
		return;
	}
	cout << "Root Element value: " << buf << endl;
	schl->RemoveAttribute("name");
	schl->SetValue("NewSchool");


	cout << "Save file: " << (doc.SaveFile("conf/new.xml") ? "Ok" : "Failed") << endl;

return ;
	TiXmlElement *rootElement = doc.RootElement();
	TiXmlElement *classElement = rootElement->FirstChildElement();
	TiXmlElement *studentElement = classElement->FirstChildElement();


	// N 个 Student 节点
	for ( ; studentElement!= NULL; studentElement = studentElement->NextSiblingElement()) 
	{
		// 获得student
		TiXmlAttribute *stuAttribute = studentElement->FirstAttribute();
		for (; stuAttribute != NULL; stuAttribute = stuAttribute->Next()) 
		{
			cout << stuAttribute->Name() << " : " << stuAttribute->Value() << endl;
		}

		// 获得student的第一个联系方式 
		TiXmlElement *contact = studentElement->FirstChildElement();
		for (; contact != NULL; contact = contact->NextSiblingElement())
		{
			const char *text = contact->GetText();
			char buf[1024] = {0};
			if ( u2g(text, strlen(text), buf, sizeof(buf)) == -1) {
				continue;
			}
			cout << contact->Value() << " : " << buf << endl; 
		}
	}
}
开发者ID:PoppyRobot,项目名称:codeStudy,代码行数:95,代码来源:main.cpp


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