本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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;
}
示例6: set
void IXMLConfigProperty::set(const std::string& value)
{
TiXmlText* text = mPElement->FirstChild()->ToText();
if (text != NULL)
text->SetValue(value.c_str());
}
示例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;
//.........这里部分代码省略.........
示例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" );