我有以下内容:
TiXmlDocument doc;
TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "utf-8", "");
doc.LinkEndChild( decl );
TiXmlElement * root = new TiXmlElement( "Value" );
TiXmlElement * element = new TiXmlElement( "number" );
root->LinkEndChild( element);
TiXmlText * text = new TiXmlText( "5" );
element->LinkEndChild( text );
可以这样吗?我希望拥有 .xml,例如:
<Value>
<number>5</number>
</Value>
谢谢!
我的问题是我是否可以将 int 值作为字符串。如果它;如果我以这种方式发送 xml 文件可以吗?或者有没有办法指定 5 是一个 int 而不是一个文本?