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


C++ TiXmlText::SetValue方法代码示例

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


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

示例1: addString

void CTinyXMLAttributeExchangingObject::addString(const string& name, const string& attribute)
{
	TiXmlText* myElement = new TiXmlText(name.c_str());
	myElement->SetValue(attribute.c_str());
	
	mRoot->LinkEndChild(myElement);
}
开发者ID:mmoczkowski,项目名称:Sathra-Game-Engine-Architecture,代码行数:7,代码来源:CTinyXMLAttributeExchangingObject.cpp

示例2: setConfigSetting

void Configuration::setConfigSetting(string sectionName, string settingName, string settingValue)
{
	TiXmlElement* setting = findConfigSetting(sectionName, settingName);
	if (setting)
	{
		TiXmlText* settingText = setting->ToText();
		if (settingText)
			settingText->SetValue(settingValue);
	}
	else
	{
		// Check to see if the section exists
		TiXmlHandle docHandle(&configs);
		TiXmlElement* newSection = docHandle.FirstChild("osdb").FirstChild(sectionName).ToElement();
		if (!newSection)
		{
			newSection = new TiXmlElement(sectionName);
			configs.RootElement()->LinkEndChild(newSection);
		}

		TiXmlElement* newSettingElement = new TiXmlElement(settingName);
		newSettingElement->LinkEndChild(new TiXmlText(settingValue));
		newSection->LinkEndChild(newSettingElement);
	}

	saveConfig();
}
开发者ID:ButtaKnife,项目名称:osdb,代码行数:27,代码来源:Configuration.cpp

示例3: ModifyElemValue

/**************************************************************************
* name       : ModifyElemValue
* description: 修改元素值
* input      : pszElemValue 元素值
* output     : NA
* return     : NA
* remark     : NA
**************************************************************************/
void CXml::ModifyElemValue(const char *pszElemValue)
{
    if (NULL == pszElemValue)
    {
        return;
    }

    if (NULL == m_pXmlNode)
    {
        return;
    }

	if (NULL == m_pXmlNode->FirstChild())
	{
		(void)SetElemValue(pszElemValue);
		return;
	}

    TiXmlText *pXmlText = m_pXmlNode->FirstChild()->ToText();

    //判断指针是否为空
    if (NULL == pXmlText)
    {
        return;
    }

    pXmlText->SetValue(pszElemValue);
}
开发者ID:eSDK,项目名称:esdk_elte,代码行数:36,代码来源:eLTE_Xml.cpp

示例4: ModifyElemValueCDATA

void CXml::ModifyElemValueCDATA(const char *pszElemValue)
{
	if (NULL == pszElemValue)
	{
		return;
	}

	if (NULL == m_pXmlNode)
	{
		return;
	}

	TiXmlText *pXmlText = m_pXmlNode->FirstChild()->ToText();

    //判断指针是否为空
    CHECK_POINTER_VOID(pXmlText);

	pXmlText->SetCDATA(true);  // 添加CDATA属性
	pXmlText->SetValue(pszElemValue);
}
开发者ID:eSDK,项目名称:esdk_elte,代码行数:20,代码来源:eLTE_Xml.cpp

示例5: setValueText

//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool XmlElementImpl::setValueText(const String& text)
{
    TiXmlText* pText = NULL;
    TiXmlNode* pNode = NULL;
    for (pNode = FirstChild(); pNode; pNode = pNode->NextSibling())
    {
        pText = pNode->ToText();
        if (pText) break;
    }

    cvf::CharArray charArr = text.toUtf8();

    if (pText) 
    {
       pText->SetValue(charArr.ptr());
    }
    else
    {
        pText = new TiXmlText(charArr.ptr());
        LinkEndChild(pText);
    }

    return true;
}
开发者ID:CeetronAS,项目名称:CustomVisualizationCore,代码行数:27,代码来源:cvfXml.cpp

示例6: set

void IXMLConfigProperty::set(const std::string& value)
{
	TiXmlText* text = mPElement->FirstChild()->ToText();
	if (text != NULL)
		text->SetValue(value.c_str());
}
开发者ID:ikoryakovskiy,项目名称:grl,代码行数:6,代码来源:XMLConfiguration.cpp

示例7: PointPlacemark

std::string Kml::PointPlacemark(  TiXmlElement* document, RoutePoint* routepoint ) {
    TiXmlElement* pmPoint = new TiXmlElement( "Placemark" );
    document->LinkEndChild( pmPoint );
    TiXmlElement* pmPointName = new TiXmlElement( "name" );
    pmPoint->LinkEndChild( pmPointName );
    TiXmlText* pmPointNameVal = new TiXmlText( routepoint->GetName().mb_str( wxConvUTF8 ) );
    pmPointName->LinkEndChild( pmPointNameVal );

    TiXmlElement* pointDescr = new TiXmlElement( "description" );
    pmPoint->LinkEndChild( pointDescr );

    bool descrIsPlainText = true;
    wxCharBuffer descrString = routepoint->m_MarkDescription.mb_str( wxConvUTF8 );

    if( insertQtVlmExtendedData ) {
        // Does the RoutePoint description parse as XML with an <ExtendedData> root tag?
        TiXmlDocument descrDoc;
        TiXmlElement* extendedData;
        if( descrDoc.Parse( descrString, 0, TIXML_ENCODING_UTF8 ) ) {
            if( 0 == strncmp( descrDoc.RootElement()->Value(), "ExtendedData", 12 ) ) {
                descrIsPlainText = false;
                extendedData = descrDoc.RootElement();
                TiXmlHandle docHandle( &descrDoc );
                TiXmlElement* seq = docHandle.FirstChild( "ExtendedData" ).FirstChild( "vlm:sequence" ).ToElement();
                if( ! seq ) {
                    seq = new TiXmlElement( "vlm:sequence" );
                    TiXmlText* snVal = new TiXmlText(
                            wxString::Format( _T("%04d"), seqCounter ).mb_str( wxConvUTF8 ) );
                    seq->LinkEndChild( snVal );
                    descrDoc.RootElement()->LinkEndChild( seq );
                }
                pmPoint->LinkEndChild( descrDoc.RootElement()->Clone() );
            }
        }
        if( descrIsPlainText ) {
            // We want Sequence names but there was some non-parsing stuff in the description.
            // Push that into a sub-tag of an XML formatted description.
            extendedData = new TiXmlElement( "ExtendedData" );
            pmPoint->LinkEndChild( extendedData );
            TiXmlElement* seq = new TiXmlElement( "vlm:sequence" );
            extendedData->LinkEndChild( seq );
            TiXmlText* snVal = new TiXmlText(
                    wxString::Format( _T("%04d"), seqCounter ).mb_str( wxConvUTF8 ) );
            seq->LinkEndChild( snVal );

            if( routepoint->m_MarkDescription.Length() ) {
                TiXmlElement* data = new TiXmlElement( "Data" );
                data->SetAttribute( "name", "Description" );
                extendedData->LinkEndChild( data );

                TiXmlElement* value = new TiXmlElement( "value" );
                data->LinkEndChild( value );
                TiXmlText* txtVal = new TiXmlText( descrString );
                value->LinkEndChild( txtVal );
            }
        }
        if( extendedData && seqCounter == 0 ) {
            const wxCharBuffer ownshipPos = wxString::Format( _T("%f %f"), gLon, gLat ).mb_str( wxConvUTF8 );
            TiXmlHandle h( extendedData );
            TiXmlElement* route = h.FirstChild( "vlm:route" ).ToElement();
            TiXmlElement* ownship = h.FirstChild( "vlm:route" ).FirstChild( "ownship" ).ToElement();
            if( route ) {
                if( ownship ) {
                    TiXmlText* owns = ownship->FirstChild()->ToText();
                    if( owns ) {
                        owns->SetValue( ownshipPos );
                    } else {
                        owns = new TiXmlText( ownshipPos );
                        ownship->LinkEndChild( owns );
                    }
                } else {
                    ownship = new TiXmlElement( "ownship" );
                    route->LinkEndChild( ownship );
                    TiXmlText* owns = new TiXmlText( ownshipPos );
                    ownship->LinkEndChild( owns );
                }
            } else {
                route = new TiXmlElement( "vlm:route" );
                extendedData->LinkEndChild( route );
                ownship = new TiXmlElement( "ownship" );
                route->LinkEndChild( ownship );
                TiXmlText* owns = new TiXmlText( ownshipPos );
                ownship->LinkEndChild( owns );
            }
        }
    }

    else {
        // Add description as dumb text.
        TiXmlText* pointDescrVal = new TiXmlText( descrString );
        pointDescr->LinkEndChild( pointDescrVal );
    }

    TiXmlElement* point = new TiXmlElement( "Point" );
    pmPoint->LinkEndChild( point );

    TiXmlElement* pointCoord = new TiXmlElement( "coordinates" );
    point->LinkEndChild( pointCoord );

    std::stringstream pointCoordStr;
//.........这里部分代码省略.........
开发者ID:NicolasJourden,项目名称:OpenCPN,代码行数:101,代码来源:kml.cpp

示例8: main


//.........这里部分代码省略.........

	// Going to the toy store is now our second priority...
	// So set the "priority" attribute of the first item in the list.
	node = todoElement->FirstChild();
	assert( node );
	itemElement = node->ToElement();
	assert( itemElement  );
	itemElement->SetAttribute( "priority", 2 );

	// Change the distance to "doing bills" from
	// "none" to "here". It's the next sibling element.
	itemElement = itemElement->NextSiblingElement();
	itemElement->SetAttribute( "distance", "here" );

	// Remove the "Look for Evil Dinosours!" item.
	// It is 1 more sibling away. We ask the parent to remove
	// a particular child.
	itemElement = itemElement->NextSiblingElement();
	todoElement->RemoveChild( itemElement );

	itemElement = 0;

	// --------------------------------------------------------
	// What follows is an example of created elements and text
	// nodes and adding them to the document.
	// --------------------------------------------------------

	// Add some meetings.
	TiXmlElement item( "Item" );
	item.SetAttribute( "priority", "1" );
	item.SetAttribute( "distance", "far" );

	TiXmlText text;
	text.SetValue( "Talk to:" );

	TiXmlElement meeting1( "Meeting" );
	meeting1.SetAttribute( "where", "School" );

	TiXmlElement meeting2( "Meeting" );
	meeting2.SetAttribute( "where", "Lunch" );

	TiXmlElement attendee1( "Attendee" );
	attendee1.SetAttribute( "name", "Marple" );
	attendee1.SetAttribute( "position", "teacher" );

	TiXmlElement attendee2( "Attendee" );
	attendee2.SetAttribute( "name", "Voo" );
	attendee2.SetAttribute( "position", "counselor" );

	// Assemble the nodes we've created:
	meeting1.InsertEndChild( attendee1 );
	meeting1.InsertEndChild( attendee2 );

	item.InsertEndChild( text );
	item.InsertEndChild( meeting1 );
	item.InsertEndChild( meeting2 );

	// And add the node to the existing list after the first child.
	node = todoElement->FirstChild( "Item" );
	assert( node );
	itemElement = node->ToElement();
	assert( itemElement );

	todoElement->InsertAfterChild( itemElement, item );

	printf( "\n** Demo doc processed: ** \n\n" );
开发者ID:krunt,项目名称:projects,代码行数:67,代码来源:xmltest.cpp


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