本文整理汇总了C++中TiXmlNode::Value方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlNode::Value方法的具体用法?C++ TiXmlNode::Value怎么用?C++ TiXmlNode::Value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlNode
的用法示例。
在下文中一共展示了TiXmlNode::Value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scanCoreXML
/**
* Scan the core node that will have the pins and clock nodes.
* Also will read the core ID and the core id address.
* @param xml is the xml node "pins"
* @return RES_OK or ERROR_XML if the attribute was not found.
*/
int ResourceMap::scanCoreXML(TiXmlNode *xml)
{
const char* description;
TiXmlNode* cChild;
// Get the address and ID information from core node
if ((getXMLAttribute(xml, "addr",&this->core_addr)<0)||
(getXMLAttribute(xml, "id",&this->core_id)<0))
{
return ERROR_XML;
}
// Get the core description and store it
description = xml->ToElement()->Attribute("description");
if (description) {
if (core_description) free(core_description);
core_description = strdup(description);
} else {
if (core_description) free(core_description);
core_description = NULL;
}
cChild=xml->FirstChild();
while(cChild!=0)
{
if (strcmp(cChild->Value(),"clocks")==0)
{
scanCoreXMLClocks(cChild);
} else if (strcmp(cChild->Value(),"pins")==0)
{
scanCoreXMLPins(cChild);
}
cChild = cChild->NextSibling();
}
return 0;
}
示例2: string
std::string GD_EXTENSION_API GetText(const std::string &refName, RuntimeScene &scene)
{
TiXmlNode *refNode = RefManager::Get(&scene)->GetRef(refName);
if(refNode)
{
return std::string(refNode->Value());
}
return "";
}
示例3: GetItemValue
//GetItemValue
String XmlArchiveFile::GetItemValue( TiXmlNode* node )
{
String value = "";
if ( node )
{
TiXmlNode* valNode = node->FirstChild();
if ( valNode && valNode->Type() == TiXmlNode::TEXT )
value = valNode->Value();
}
return value;
}
示例4: GetElementChildValue
std::string GetElementChildValue(TiXmlElement *pElement, const char *szChildName)
{
std::string ret;
TiXmlNode *pNode = pElement->FirstChild(szChildName);
if (!pNode)
return ret;
pNode = pNode->FirstChild();
if (!pNode)
return ret;
ret = pNode->Value();
return ret;
}
示例5: GetTextElement
wxString GetTextElement(TiXmlElement* node)
{
wxASSERT(node);
for (TiXmlNode* pChild = node->FirstChild(); pChild; pChild = pChild->NextSibling()) {
if (pChild->ToText()) {
return ConvLocal(pChild->Value());
}
}
return wxString();
}
示例6:
TiXmlNode *TiXmlNode::LastChild(const char *_value)
{
TiXmlNode *node;
for (node = lastChild; node; node = node->prev)
{
if (strcmp(node->Value(), _value) == 0)
{
return node;
}
}
return 0;
}
示例7:
vector<TiXmlNode*> XmlParser::getAgentChildren(TiXmlNode* node)
{
vector<TiXmlNode*> agentChildren;
for (TiXmlNode* child = node->FirstChild(); child; child = child->NextSibling()) {
string value = child->Value();
if (child != NULL && !value.empty() && // if node has defined value
this->tagParsers.count(value) > 0) { // that matches a tag parser
agentChildren.push_back(child);
}
}
return agentChildren;
}
示例8: addNode
XmlNode TinyXmlInterface::addNode(TiXmlNode* n) {
if (!n) throw CasadiException("Error in TinyXmlInterface::addNode: Node is 0");
XmlNode ret;
// Save name
ret.setName(n->Value());
// Save attributes
int type = n->Type();
if (type == TiXmlNode::TINYXML_ELEMENT) {
if (n->ToElement()!=0) {
for (TiXmlAttribute* pAttrib=n->ToElement()->FirstAttribute();
pAttrib;
pAttrib=pAttrib->Next()) {
ret.setAttribute(pAttrib->Name(), pAttrib->Value());
}
}
} else if (type == TiXmlNode::TINYXML_DOCUMENT) {
// do nothing
} else {
throw CasadiException("TinyXmlInterface::addNode");
}
// Count the number of children
int num_children = 0;
for (TiXmlNode* child = n->FirstChild(); child != 0; child= child->NextSibling()) {
num_children++;
}
ret.children_.reserve(num_children);
// add children
int ch = 0;
for (TiXmlNode* child = n->FirstChild(); child != 0; child= child->NextSibling(), ++ch) {
int childtype = child->Type();
if (childtype == TiXmlNode::TINYXML_ELEMENT) {
XmlNode newnode = addNode(child);
ret.children_.push_back(newnode);
ret.child_indices_[newnode.getName()] = ch;
} else if (childtype == TiXmlNode::TINYXML_COMMENT) {
ret.comment_ = child->Value();
} else if (childtype == TiXmlNode::TINYXML_TEXT) {
ret.text_ = child->ToText()->Value();
} else if (childtype == TiXmlNode::TINYXML_DECLARATION) {
cout << "Warning: Skipped TiXmlNode::TINYXML_DECLARATION" << endl;
} else {
throw CasadiException("Error in TinyXmlInterface::addNode: Unknown node type");
}
}
// Note: Return value optimization
return ret;
}
示例9: FindNode
TiXmlNode* XMLDocument::FindNode( const kvs::XMLDocument* document, const std::string& node_name )
{
TiXmlNode* node = document->FirstChild();
while( node )
{
if( node->Value() == node_name ) return node;
node = node->NextSibling();
}
return NULL;
}
示例10: writeconf
bool writeconf(int hconf,char *option,char *field,char *value )
{
TiXmlNode *node = 0;
TiXmlElement *rootElement = 0;
TiXmlElement *settingElement = 0;
TiXmlElement *fieldElement = 0;
TiXmlElement *newldElement = 0;
TiXmlDocument *pdoc = 0;
TiXmlText *pTextValue = 0;
TiXmlNode *pTextNode = 0;
if(hconf){
pdoc = (TiXmlDocument*)hconf;
} else {
return false;
}
node = pdoc->RootElement();
if(!node){ //here we need create a new node
node = new TiXmlElement(ROOT_NAME);
pdoc->LinkEndChild(node);
//root element no exist,the create a new element
}
if(strcmp(ROOT_NAME,node->Value())){
//delete and create a new one
return false;
}
rootElement = node->ToElement(); //we come to <SNWTool> </SNWTool> element
settingElement = rootElement->FirstChildElement(option);
if( settingElement) {
fieldElement = settingElement->FirstChildElement(field);
if(fieldElement){
pTextNode = fieldElement->FirstChild();
if(pTextNode) {
pTextNode->SetValue(value);
} else {
pTextValue = new TiXmlText(value);
fieldElement->LinkEndChild(pTextValue);
}
} else {
pTextValue = new TiXmlText(value);
fieldElement = new TiXmlElement(field);
fieldElement->LinkEndChild(pTextValue);
settingElement->LinkEndChild( fieldElement );
}
} else {
pTextValue = new TiXmlText(value);
fieldElement = new TiXmlElement(field);
fieldElement->LinkEndChild(pTextValue);
settingElement = new TiXmlElement(option);
settingElement->LinkEndChild( fieldElement );
rootElement->LinkEndChild( settingElement );
}
return true;
}
示例11: getString
//FIXME
string CTinyXMLAttributeExchangingObject::getString(const string& name) throw(CParsingException)
{
for(TiXmlNode* child = mRoot->FirstChild(name.c_str()); child; child = child->NextSibling(name.c_str()))
{
/*TiXmlText* myElement = child->ToText();
if(myElement)
*/return child->Value();
}
THROW_PARSING("Element \"" + name + "\" not found.");
}
开发者ID:mmoczkowski,项目名称:Sathra-Game-Engine-Architecture,代码行数:13,代码来源:CTinyXMLAttributeExchangingObject.cpp
示例12: Parse
int KSGTaskParams::Parse(const std::string& str)
{
TiXmlDocument doc;
doc.Parse(str.c_str());
TiXmlNode* root = doc.FirstChild("taskdef");
if(!root)
return -1;
TiXmlNode* elem = root->FirstChild();
while(elem!=NULL)
{
//elem->f
TiXmlNode* t = elem->FirstChild();
if(t)
PutParam(elem->Value(),t->Value());
else
PutParam(elem->Value(),"");
elem = elem->NextSibling();
}
return 0;
}
示例13: readvalue
bool readvalue(int hconf,const char *field,char *value,int *cnt)
{
TiXmlNode *node = 0;
TiXmlElement *rootElement = 0;
//TiXmlElement *settingElement = 0;
TiXmlElement *fieldElement = 0;
TiXmlElement *newldElement = 0;
TiXmlDocument *pdoc = 0;
TiXmlText *pTextValue = 0;
TiXmlNode *pTextNode = 0;
const char *tvalue = 0;
//every node no exist we should return false
if(hconf){
pdoc = (TiXmlDocument*)hconf;
} else {
return false;
}
node = pdoc->RootElement();
if(!node){
return false;
}
if(strcmp(ROOT_NAME,node->Value())){
//delete and create a new one
return false;
}
rootElement = node->ToElement(); //we enter <SNWTool> </SNWTool> element
fieldElement = rootElement->FirstChildElement(field);
if(fieldElement){
pTextNode = fieldElement->FirstChild();
if(pTextNode) {
tvalue = pTextNode->Value();
if(strlen(tvalue) < *cnt - 1){
strcpy_s(value,*cnt,tvalue);
*cnt = strlen(tvalue);
return true;
}
}
}
return false;
}
示例14: ProcessTitle
/*
* Handle <title>.
*/
bool PhoneData::ProcessTitle(TiXmlNode* pNode)
{
TiXmlNode* pChild;
pChild = pNode->FirstChild();
if (pChild->Type() != TiXmlNode::TEXT) {
fprintf(stderr, "SimCFG: title is funky\n");
return false;
}
SetTitle(pChild->Value());
return true;
}
示例15: ProcessAndValidate
/*
* TinyXml has loaded and parsed the XML document for us. We need to
* run through the DOM tree, pull out the interesting bits, and make
* sure the stuff we need is present.
*
* Returns "true" on success, "false" on failure.
*/
bool PhoneData::ProcessAndValidate(TiXmlDocument* pDoc)
{
bool deviceFound = false;
TiXmlNode* pChild;
assert(pDoc->Type() == TiXmlNode::DOCUMENT);
for (pChild = pDoc->FirstChild(); pChild != NULL;
pChild = pChild->NextSibling())
{
/*
* Find the <device> entry. There should be exactly one.
*/
if (pChild->Type() == TiXmlNode::ELEMENT) {
if (strcasecmp(pChild->Value(), "device") != 0) {
fprintf(stderr,
"SimCFG: Warning: unexpected element '%s' at top level\n",
pChild->Value());
continue;
}
if (deviceFound) {
fprintf(stderr, "SimCFG: one <device> per customer\n");
return false;
}
bool result = ProcessDevice(pChild);
if (!result)
return false;
deviceFound = true;
}
}
if (!deviceFound) {
fprintf(stderr, "SimCFG: no <device> section found\n");
return false;
}
return true;
}