本文整理汇总了C++中TiXmlNode::Type方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlNode::Type方法的具体用法?C++ TiXmlNode::Type怎么用?C++ TiXmlNode::Type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlNode
的用法示例。
在下文中一共展示了TiXmlNode::Type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: XmlValuePtr
XmlValuePtr XmlReader::operator[] ( const char *name ) const
{
TiXmlNode *node = pd->doc->FirstChild(name);
if (node == NULL)
{
LOG(ERROR) << "Xml node " << name << " not found";
return XmlValuePtr(new XmlValue());
}
TiXmlElement *element = node->ToElement();
if (element == NULL)
{
LOG(ERROR) << "Xml node " << name
<< " not element, type = " << node->Type();
return XmlValuePtr(new XmlValue());
}
return XmlValuePtr(new XmlNode(element));
}
示例2: FindNextNotOf
TiXmlNode * FindNextNotOf(TiXmlNode * node, const char * ids[])
{
if(!node)
return NULL;
TiXmlNode * loc;
int index;
return false;
for(loc = node->NextSibling(); loc; loc = loc->NextSibling()) {
if (loc->Type() == TiXmlNode::COMMENT)
continue;
index = 0;
indexcheck:
if(NodeIs(loc,ids[index]))
continue;
if(ids[++index]) goto indexcheck;
return loc;
}
return NULL;
}
示例3: main
int main(int argc, char * argv[])
{
cout << "begin test xml : " << endl;
CxApplication::init(argc, argv);
string sFilePath = CxFileSystem::mergeFilePath(CxApplication::applicationPath(), "cics");
sFilePath = CxFileSystem::mergeFilePath(sFilePath, "template_00304.xml");
if (! CxFileSystem::isExist(sFilePath))
return 0;
string sReceived;
CxFile::load(sFilePath, sReceived);
TiXmlDocument doc;
doc.Parse(sReceived.c_str());
// doc.LoadFile(sFilePath);
TiXmlNode * root = doc.FirstChild();
if (root->Type() == TiXmlNode::TINYXML_DECLARATION)
root = root->NextSibling();
cout << string(0, ' ') << root->Value() << endl;
for( TiXmlElement * node1Level = root->FirstChildElement(); node1Level; node1Level = node1Level->NextSiblingElement() )
{
cout << string(4, ' ') << node1Level->Value() << endl;
for( TiXmlElement * node2Level = node1Level->FirstChildElement(); node2Level; node2Level = node2Level->NextSiblingElement() )
{
string sValue;
for( TiXmlNode * node3Level = node2Level->FirstChild(); node3Level; node3Level = node3Level->NextSibling() )
{
if (node3Level->Type() == TiXmlNode::TINYXML_TEXT)
{
sValue = node3Level->ToText()->Value();
break;
}
}
cout << string(8, ' ') << node2Level->Value() << "=" << sValue << endl;
}
}
return 0;
}
示例4: parsePartition
void XCFParser::parsePartition(TiXmlElement* partition){
TiXmlString partitionId (partition->Attribute(XCFMapping::PARTITION_ID));
TiXmlNode* node = partition->FirstChild();
while (node != NULL){
if (node->Type() == TiXmlNode::TINYXML_ELEMENT) {
TiXmlElement* element = (TiXmlElement*)node;
TiXmlString name(node->Value());
if (name == XCFMapping::INSTANCE) {
TiXmlString instanceId (element->Attribute(XCFMapping::INSTANCE_ID));
mapStr->insert(pair<string,string>(instanceId.c_str(), partitionId.c_str()));
}else {
cerr << "Invalid node "<< name.c_str() << endl;
exit(1);
}
}
node = node->NextSibling();
}
}
示例5: loadXmlInto
void loadXmlInto(const std::string& arFileName, IXMLDataBound* sps)
{
TiXmlDocument doc(arFileName);
if(!doc.LoadFile())
{
std::ostringstream oss;
oss << "Load file failed on: " << arFileName << " - " << doc.ErrorDesc() << " at " << doc.ErrorRow() << ":"<< doc.ErrorCol();
throw Exception("loadXmlInto", oss.str(), IXMLDataBound::ERR_XML_NO_FILE);
}
if(!doc.Type() == TiXmlNode::DOCUMENT)
throw Exception("loadXmlInto","Document is not of type TiXmlNode::DOCUMENT");
TiXmlNode* node = doc.FirstChild();
TiXmlNode* lastChild = doc.LastChild();
while(node->Type() != TiXmlNode::ELEMENT && node != lastChild){
node = node->NextSibling();
}
sps->fromXml(node);
};
示例6: OfferConfig
void MainFrame::OfferConfig(TiXmlDocument* config, wxListBox* listbox,
std::vector<TiXmlNode*> *nodes)
{
// put configuration to wxCheckListBox or wxListBox
nodes->clear();
listbox->Clear();
TiXmlElement* cfgroot = config->FirstChildElement("CodeBlocksConfig");
if (!TiXmlSuccess(config))
return;
TiXmlNode* child = NULL;
for (child = cfgroot->FirstChild(); child; child = child->NextSibling())
{
if (child->Type()==TiXmlNode::ELEMENT)
{
OfferNode(&child, listbox, nodes);
}
}
}// OfferConfig
示例7: matNode
void XmlParser::matNode(TiXmlNode* pParent) {
TiXmlNode* pChild;
for (pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) {
int t = pChild->Type();
if (t == TiXmlNode::ELEMENT) {
string element_value(pChild->Value());
if (element_value == "macro-xs")
objects.push_back(macroAttrib(pChild->ToElement()));
else if (element_value == "material") {
vector<McObject*> ace_objects = aceAttrib(pChild->ToElement());
objects.insert(objects.end(), ace_objects.begin(), ace_objects.end());
} else {
vector<string> keywords;
keywords.push_back(element_value);
throw KeywordParserError("Unrecognized material keyword <" + element_value + ">",keywords);
}
}
}
}
示例8: srcNode
void XmlParser::srcNode(TiXmlNode* pParent) {
TiXmlNode* pChild;
for (pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) {
int t = pChild->Type();
if (t == TiXmlNode::ELEMENT) {
string element_value(pChild->Value());
if (element_value == "dist")
objects.push_back(distAttrib(pChild->ToElement()));
else if (element_value == "sampler")
objects.push_back(samplerAttrib(pChild->ToElement()));
else if (element_value == "source")
objects.push_back(sourceAttrib(pChild->ToElement()));
else {
vector<string> keywords;
keywords.push_back(element_value);
throw KeywordParserError("Unrecognized source keyword <" + element_value + ">",keywords);
}
}
}
}
示例9:
TiXmlText*
PluginXmlParser::requireText (
const TiXmlElement& elem,
OsStatus* err)
{
TiXmlNode* tn = (TiXmlNode*)elem.FirstChild();
if (tn != NULL && tn->Type() == TiXmlNode::TEXT)
{
TiXmlText* t = tn->ToText();
if (t->Value() != NULL)
{
return t;
}
}
OsSysLog::add(FAC_SIP, PRI_ERR, "PluginXmlParser::requiredText "
"missing element text body %s ", elem.Value());
*err = OS_FAILED;
return NULL;
}
示例10: checksum
unsigned int Handle_t::checksum(unsigned int param, fcn_t fcn) const {
#ifdef DD4HEP_USE_TINYXML
typedef map<string, string> StringMap;
TiXmlNode* n = Xml(m_node).n;
if ( n ) {
if ( 0 == fcn ) fcn = adler32;
switch (n->Type()) {
case TiXmlNode::ELEMENT: {
map<string,string> m;
TiXmlElement* e = n->ToElement();
TiXmlAttribute* p=e->FirstAttribute();
for(; p; p=p->Next()) m.insert(make_pair(p->Name(),p->Value()));
param = (*fcn)(param,e->Value(),::strlen(e->Value()));
for(StringMap::const_iterator i=m.begin();i!=m.end();++i) {
param = (*fcn)(param,(*i).first.c_str(),(*i).first.length());
param = (*fcn)(param,(*i).second.c_str(),(*i).second.length());
}
break;
}
case TiXmlNode::TEXT:
param = (*fcn)(param,n->ToText()->Value(),::strlen(n->ToText()->Value()));
break;
case TiXmlNode::UNKNOWN:
case TiXmlNode::COMMENT:
case TiXmlNode::DOCUMENT:
case TiXmlNode::DECLARATION:
default:
break;
}
for(TiXmlNode* c=n->FirstChild(); c; c=c->NextSibling())
param = Handle_t((XmlElement*)c->ToElement()).checksum(param,fcn);
}
#else
if ( 0 == fcn ) fcn = adler32;
if ( 0 == fcn ) {
}
#endif
return param;
}
示例11: 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;
}
示例12: geoNode
void XmlParser::geoNode(TiXmlNode* pParent) {
TiXmlNode* pChild;
for (pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) {
int t = pChild->Type();
if (t == TiXmlNode::ELEMENT) {
string element_value(pChild->Value());
if (element_value == "surface")
objects.push_back(surfaceAttrib(pChild->ToElement()));
else if (element_value == "cell")
objects.push_back(cellAttrib(pChild->ToElement()));
else if (element_value == "lattice")
objects.push_back(latticeAttrib(pChild->ToElement()));
else {
vector<string> keywords;
keywords.push_back(element_value);
throw KeywordParserError("Unrecognized geometry keyword <" + element_value + ">",keywords);
}
}
}
}
示例13: parsePartitioning
void XCFParser::parsePartitioning(TiXmlElement* root){
TiXmlNode* node = root->FirstChild();
while (node != NULL){
if (node->Type() == TiXmlNode::TINYXML_ELEMENT) {
TiXmlElement* element = (TiXmlElement*)node;
TiXmlString name(node->Value());
if (name == XCFMapping::PARTITIONING) {
parsePartitioning(element);
}else if (name == XCFMapping::PARTITION) {
parsePartition(element);
}else {
cerr << "Invalid node "<< name.c_str() << endl;
exit(1);
}
}
node = node->NextSibling();
}
}
示例14: loadScene
Scene* SceneLoader::loadScene(Ogre::DataStreamPtr &data)
{
TiXmlDocument* doc = loadDocument(data);
TiXmlElement* root = doc->RootElement();
Scene* scene = new Scene(getAttributeValueAsString(root, "name"));
for (TiXmlNode* cur = root->FirstChild(); cur; cur = cur->NextSibling())
{
if (cur->Type() == TiXmlNode::ELEMENT)
{
TiXmlElement* elem = cur->ToElement();
if (hasNodeName(elem, "map"))
{
scene->addMap(getAttributeValueAsStdString(elem, "file"));
}
}
}
delete doc;
return scene;
}
示例15: LoadKeymap
bool CButtonTranslator::LoadKeymap(const CStdString &keymapPath)
{
TiXmlDocument xmlDoc;
CLog::Log(LOGINFO, "Loading %s", keymapPath.c_str());
if (!xmlDoc.LoadFile(keymapPath))
{
CLog::Log(LOGERROR, "Error loading keymap: %s, Line %d\n%s", keymapPath.c_str(), xmlDoc.ErrorRow(), xmlDoc.ErrorDesc());
return false;
}
TiXmlElement* pRoot = xmlDoc.RootElement();
CStdString strValue = pRoot->Value();
if ( strValue != "keymap")
{
CLog::Log(LOGERROR, "%s Doesn't contain <keymap>", keymapPath.c_str());
return false;
}
// run through our window groups
TiXmlNode* pWindow = pRoot->FirstChild();
while (pWindow)
{
if (pWindow->Type() == TiXmlNode::ELEMENT)
{
int windowID = WINDOW_INVALID;
const char *szWindow = pWindow->Value();
if (szWindow)
{
if (strcmpi(szWindow, "global") == 0)
windowID = -1;
else
windowID = TranslateWindow(szWindow);
}
MapWindowActions(pWindow, windowID);
}
pWindow = pWindow->NextSibling();
}
return true;
}