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


C++ XMLNode::NextSibling方法代码示例

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


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

示例1: Display

void XMLElement::Display() const 
{
	cout << "<" << value;

	const XMLAttribute* attrib = NULL;
	for ( attrib = attributes.First_Const(); attrib; attrib = attrib->Next_Const() )
	{	
		cout << " ";
		attrib->Display();
	}

	XMLNode* node = NULL;
	if ( firstChild )
	{ 		
		cout << ">";

		for ( node = firstChild; node; node=node->NextSibling() )
		{
			node->Display( );
		}
		cout << "</" << value << ">";
	}
	else
	{
		cout << " />";
	}
}
开发者ID:zipxin,项目名称:OnlyXML,代码行数:27,代码来源:OnlyXMLToFile.cpp

示例2: readXMLArena

void Arena::readXMLArena(const char* path){
    cout << "Reading arena at: " << path << endl;
	XMLDocument doc;
	doc.LoadFile(path);

	XMLNode* svgObjs = doc.FirstChildElement("svg")->FirstChild();
	while(svgObjs != NULL){

		XMLElement * obj = svgObjs->ToElement();

		if(strcmp(obj->Attribute("id"),"Arena") == 0){
			this->arena = Rect(	atof(obj->Attribute("x")),
												atof(obj->Attribute("y")),
												atof(obj->Attribute("width")),
												atof(obj->Attribute("height")),
												obj->Attribute("fill"),
												atof(obj->Attribute("stroke-width")),
												obj->Attribute("stroke"),
												obj->Attribute("id"));
		}

		if(strcmp(obj->Attribute("id"),"PostoAbastecimento") == 0){
			this->postoAbastecimento = Rect(	atof(obj->Attribute("x")),
												atof(obj->Attribute("y")),
												atof(obj->Attribute("width")),
												atof(obj->Attribute("height")),
												obj->Attribute("fill"),
												atof(obj->Attribute("stroke-width")),
												obj->Attribute("stroke"),
												obj->Attribute("id"));
		}

		if(strcmp(obj->Attribute("id"),"Jogador") == 0){
			this->jogador = Circle(	atof(obj->Attribute("cx")),
									atof(obj->Attribute("cy")),
									atof(obj->Attribute("r")),
									obj->Attribute("fill"),
									obj->Attribute("id"));
		}

		if(strcmp(obj->Attribute("id"),"Inimigo") == 0){
			this->inimigos.push_back(Circle(	atof(obj->Attribute("cx")),
													atof(obj->Attribute("cy")),
													atof(obj->Attribute("r")),
													obj->Attribute("fill"),
													obj->Attribute("id")));
		}

		if(strcmp(obj->Attribute("id"),"ObjetoResgate") == 0){
			this->objetosResgate.push_back(Circle(	atof(obj->Attribute("cx")),
													atof(obj->Attribute("cy")),
													atoi(obj->Attribute("r")),
													obj->Attribute("fill"),
													obj->Attribute("id")));
		}

		svgObjs = svgObjs->NextSibling();
	}
    cout << "OK!" << endl;
}
开发者ID:BrunoAgrizzi,项目名称:cg-tf,代码行数:60,代码来源:Arena.cpp

示例3: if

	//-----------------------------------------------------------------------
	void ConverterPass1::XmlAnnotation(XMLElement *annotation, bool startUnit)
	{
		if (!annotation)
			return;
		if (startUnit)
			units_->push_back(Unit(bodyType_, Unit::ANNOTATION, 0, -1));
		XmlAddId(annotation);

		for (XMLNode *ch = annotation->FirstChild(); ch; ch = ch->NextSibling())
		{
			//<p>, <poem>, <cite>, <subtitle>, <empty-line>, <table>
			const char *tag = ch->Value();
			if (!tag)
				continue;
			if (strcmp(tag, "p") == 0)
				p();
			else if (strcmp(tag, "poem") == 0)
				poem();
			else if (strcmp(tag, "cite") == 0)
				cite();
			else if (strcmp(tag, "subtitle") == 0)
				subtitle();
			else if (strcmp(tag, "empty-line") == 0)
				; // do nothing here, was: empty_line();
			else if (strcmp(tag, "table") == 0)
				table();
			//</p>, </poem>, </cite>, </subtitle>, </empty-line>, </table>
		}
	}
开发者ID:gregko,项目名称:EbookConverter,代码行数:30,代码来源:XmlFb2toEpub.cpp

示例4: ToFile

void XMLDoc::ToFile(FILE *file,int blankdepth)
{
	XMLNode* nodetemp = NULL;
	for ( nodetemp=FirstChild(); nodetemp; nodetemp=nodetemp->NextSibling() )
	{
		nodetemp->ToFile( file, blankdepth );
		fprintf_s( file, "\n" );
	}
}
开发者ID:zipxin,项目名称:OnlyXML,代码行数:9,代码来源:OnlyXMLToFile.cpp

示例5:

int
CSettings::ParseOutputs(XMLElement *Outputs)
{
	// Parse Outputs
	XMLElement *Output = Outputs->FirstChildElement("output");

	int NumberOfOutputs = 0;
	while(Output)
	{
		OutputContainer OutputParse;
		NumberOfOutputs++;

		if(!Output->Attribute("name"))
		{
			Log.error("Output entry has no name\n");
			return false;
		}

		// Check if there is a duplicate name
		OutputParse.name = Output->Attribute("name");
		for(list<OutputContainer>::iterator i=OutputsDB.begin(); i != OutputsDB.end(); ++i)
		{
			if(OutputParse.name.compare((*i).name) == 0)
			{
				Log.error("Duplicate output name [%s]\n", OutputParse.name.c_str());
				return false;
			}
		}


		OutputParse.type = Output->Attribute("type");

		XMLNode *OutSettings = Output->FirstChild();

		while(OutSettings)
		{
			if(OutSettings->Value() && OutSettings->ToElement()->GetText())
			{
				OutputParse.settings[OutSettings->Value()] = OutSettings->ToElement()->GetText();
				Log.debug("parsed [%s]=[%s]", OutSettings->Value(), OutputParse.settings[OutSettings->Value()].c_str());
			}

			OutSettings = OutSettings->NextSibling();
		}

		OutputsDB.push_back(OutputParse);

		Output = Output->NextSiblingElement("output");
	}


	Log.log("Parsed %d outputs\n", NumberOfOutputs);

	return true;
}
开发者ID:alxnik,项目名称:fpd,代码行数:55,代码来源:CSettings.cpp

示例6: initialize

bool AudioResourceManager::initialize()
{
    srand(time(NULL));
    Ogre::String path = Ogre::macBundlePath() + "/Contents/Resources/media/config/audio_events.xml";
    //xml_document<> doc;    // character type defaults to char
    FILE *audioConfigFile = fopen(path.data(), "r");
    
    std::vector<char> buffer;
    int c;
    while (EOF !=(c=getc(audioConfigFile))){
        buffer.push_back(c);
    }
   
    
    char buf[buffer.size()];
    for (int i = 0; i < buffer.size(); i++){
        buf[i] = buffer[i];
    }
    XMLDocument doc;
    doc.Parse(buf);

    XMLElement *eventIter = doc.FirstChildElement()->FirstChildElement();
    
    
    unsigned int currentHandle = 0;
    
    while (eventIter != NULL)
    {
        XMLNode *unitIter = eventIter->FirstChildElement()->NextSiblingElement();
        std::string eventName = eventIter->FirstChildElement()->GetText();
        
        while (unitIter != NULL) {
            AudioResource unit;
            
            unit.filename = unitIter->FirstChildElement("filename")->GetText();// first_node("filename")->value();
            printf("filename: %s\n", unit.filename.c_str());
            unit.panning = atof(unitIter->FirstChildElement("panning")->GetText());
            unit.pitch = atof(unitIter->FirstChildElement("pitch")->GetText());
            unit.looping = atoi(unitIter->FirstChildElement("looping")->GetText());
            unit.gain = atof(unitIter->FirstChildElement("gain")->GetText());
            unit.bufferHandle = -1;
            unit.sourceHandle = -1;
            if ( eventName == "apply_force_left" || eventName == "apply_force_right" || eventName=="fall_off") unit.canStop = false;
            else unit.canStop = true;
            alGenSources(1, &unit.sourceHandle);
            resources[eventName].push_back(unit);
            
            unitIter = unitIter->NextSibling();
        }
        
        eventIter = eventIter->NextSiblingElement();
    }
    return true;
}
开发者ID:OneGameAMonth,项目名称:1GAM-Jan-HaikuRacer,代码行数:54,代码来源:AudioResourceManager.cpp

示例7: getChild

 //-----------------------------------------------------------------------------
 XMLElement* XmlHelper::getChild(XMLNode *elm, Str8 tagName)
 {
     XMLNode* child                = NULL;
     XMLElement* child_elm         = NULL;
     if (elm)
     {
         for( child = elm->FirstChild(); child; child = child->NextSibling() )
         {
             child_elm = child->ToElement();
             if ( tagName==XML_GET_VALUE(child_elm) )
             {
                 return child_elm;
             }
         }
     }
     return NULL;
 }
开发者ID:dnjsflagh1,项目名称:project_utility,代码行数:18,代码来源:XmlHelper.cpp

示例8: getChildCount

    //-----------------------------------------------------------------------------
    UInt XmlHelper::getChildCount(XMLNode *elm)
    {
        XMLNode*  currNode            = elm->FirstChild();
        XMLNode*  firstSiblingNode    = currNode;
        XMLNode*  nextNode            = NULL;
        UInt        count               = 0;

        while( currNode )
        {
            //@ parallel 
            nextNode    = currNode->NextSibling();
            if (nextNode&&nextNode==firstSiblingNode)
            {
                break;
            }
            currNode = nextNode;

            count ++;
        }

        return count;
    }
开发者ID:dnjsflagh1,项目名称:project_utility,代码行数:23,代码来源:XmlHelper.cpp

示例9: readXML

void XMLConfig::readXML(const char* path){
	XMLDocument doc;
	cout << "Reading file at: " << path << endl;
	doc.LoadFile(path);

	// arquivosDeEntrada
	XMLElement* arquivosDeEntrada = doc.FirstChildElement("aplicacao")->FirstChildElement("arquivosDeEntrada");
	XMLNode* arquivo = arquivosDeEntrada->FirstChild();
	while(arquivo != NULL){

		XMLElement* arq = arquivo->ToElement();

		if(strcmp(arq->Name(),"arquivoDaArena") == 0){
			this->arena = File(arq->Attribute("nome"),
						arq->Attribute("caminho"),
						arq->Attribute("tipo"));
		}

		arquivo = arquivo->NextSibling();
	}
	cout << "OK!"<<endl;
}
开发者ID:BrunoAgrizzi,项目名称:cg-tf,代码行数:22,代码来源:XMLConfig.cpp

示例10: main


//.........这里部分代码省略.........
		element->DeleteChild( sub[2] );
		doc->DeleteNode( comment );

		element->FirstChildElement()->SetAttribute( "attrib", true );
		element->LastChildElement()->DeleteAttribute( "attrib" );

		XMLTest( "Programmatic DOM", true, doc->FirstChildElement()->FirstChildElement()->BoolAttribute( "attrib" ) );
		int value = 10;
		int result = doc->FirstChildElement()->LastChildElement()->QueryIntAttribute( "attrib", &value );
		XMLTest( "Programmatic DOM", result, XML_NO_ATTRIBUTE );
		XMLTest( "Programmatic DOM", value, 10 );

		doc->Print();

		XMLPrinter streamer;
		doc->Print( &streamer );
		printf( "%s", streamer.CStr() );

		delete doc;
	}
	{
		// Test: Dream
		// XML1 : 1,187,569 bytes	in 31,209 allocations
		// XML2 :   469,073	bytes	in    323 allocations
		//int newStart = gNew;
		XMLDocument doc;
		doc.LoadFile( "dream.xml" );

		doc.SaveFile( "dreamout.xml" );
		doc.PrintError();

		XMLTest( "Dream", "xml version=\"1.0\"",
			              doc.FirstChild()->ToDeclaration()->Value() );
		XMLTest( "Dream", true, doc.FirstChild()->NextSibling()->ToUnknown() ? true : false );
		XMLTest( "Dream", "DOCTYPE PLAY SYSTEM \"play.dtd\"",
						  doc.FirstChild()->NextSibling()->ToUnknown()->Value() );
		XMLTest( "Dream", "And Robin shall restore amends.",
			              doc.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );
		XMLTest( "Dream", "And Robin shall restore amends.",
			              doc.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );

		XMLDocument doc2;
		doc2.LoadFile( "dreamout.xml" );
		XMLTest( "Dream-out", "xml version=\"1.0\"",
			              doc2.FirstChild()->ToDeclaration()->Value() );
		XMLTest( "Dream-out", true, doc2.FirstChild()->NextSibling()->ToUnknown() ? true : false );
		XMLTest( "Dream-out", "DOCTYPE PLAY SYSTEM \"play.dtd\"",
						  doc2.FirstChild()->NextSibling()->ToUnknown()->Value() );
		XMLTest( "Dream-out", "And Robin shall restore amends.",
			              doc2.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );

		//gNewTotal = gNew - newStart;
	}


	{
		const char* error =	"<?xml version=\"1.0\" standalone=\"no\" ?>\n"
							"<passages count=\"006\" formatversion=\"20020620\">\n"
							"    <wrong error>\n"
							"</passages>";

		XMLDocument doc;
		doc.Parse( error );
		XMLTest( "Bad XML", doc.ErrorID(), XML_ERROR_PARSING_ATTRIBUTE );
	}
开发者ID:qaisjp,项目名称:green-candy,代码行数:66,代码来源:xmltest.cpp

示例11: main

int main()
{
//    CURL* curl; //our curl object
//
//    struct BufferStruct output; // Create an instance of out BufferStruct to accept LCs output
//    output.buffer = NULL;
//    output.size = 0;
//
//    curl_global_init(CURL_GLOBAL_ALL); //pretty obvious
//    curl = curl_easy_init();
//
//    curl_easy_setopt(curl, CURLOPT_URL, "http://www.findyourfate.com/rss/horoscope-astrology-feed.asp?mode=view&todate=8/20/2015");
//    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &WriteMemoryCallback);
//    curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&output);
//    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); //tell curl to output its progress
//
//    curl_easy_perform(curl);
//    curl_easy_cleanup(curl);
//
//    FILE * fp;
//    fp = fopen( "example.xml","w");
//    cout<<"HEILL!";
//    if( !fp )
//    	return 1;
//    fprintf(fp, output.buffer );
//    fclose( fp );
//
//    if( output.buffer )
//    {
//    	free ( output.buffer );
//    	output.buffer = 0;
//    	output.size = 0;
//    }
//
//    cin.get();
    XMLDocument doc;
    doc.LoadFile("example.xml");
    cout<< "ERROR ID: "<<doc.ErrorName()<<endl;

    XMLNode * pRoot = doc.FirstChild();
    if (pRoot ==NULL)
    	cout<<"ERROR!!!"<<endl;

   XMLNode* SiblingNode = pRoot->NextSibling();
   XMLNode* ChildNode = SiblingNode->FirstChild();

   XMLElement *ChildElmt = ChildNode->ToElement();
   string strTagName = ChildElmt->Name();
   cout<<strTagName<<endl;

   XMLNode* Child_2_Node = ChildNode->FirstChild();
   XMLElement *Child_2_NodeElmt = Child_2_Node->ToElement();

   strTagName = Child_2_NodeElmt->Name();
   cout<<strTagName<<endl;

   strTagName = Child_2_NodeElmt->GetText();
   cout<<strTagName<<endl;

   XMLNode* secSibling = Child_2_Node->NextSibling();
   XMLElement *Sib_2_NodeElmt = secSibling->ToElement();

  strTagName = Sib_2_NodeElmt->Name();
  cout<<strTagName<<endl;

  strTagName = Sib_2_NodeElmt->GetText();
     cout<<strTagName<<endl;

   //XMLElement* pElement = pRoot->ToElement();
   //if (pElement ==NULL)
    //      	cout<<"ERROR"<<endl;

//  XMLElement * pElement = pRoot->FirstChildElement("rss")->FirstChildElement("channel");
//  if (pElement ==NULL)
//       	cout<<"ERROR"<<endl;


//    if (pElement ==NULL)
//     	cout<<"ERROR"<<endl;
//    const char* title = pElement->GetText();
//	printf( "Name of play (1): %s\n", title );


//    cout << endl <<  pElement->GetText() << endl;
    //cin.get();







    //curl_global_cleanup();

    return 0;
}
开发者ID:kumailxp,项目名称:readRSS,代码行数:96,代码来源:rssreader.cpp

示例12: fopen

PluginChipFactory::PluginChipFactory()
{
    XMLDocument doc;
    FILE * f = fopen("atanua.xml", "rb");
    if (doc.LoadFile(f))
    {
        fclose(f);
        return;
    }
    fclose(f);
    // Load config
    XMLNode *root;
    for (root = doc.FirstChild(); root != 0; root = root->NextSibling())
    {
        if (root->ToElement())
        {
            if (stricmp(root->Value(), "AtanuaConfig")==0)
            {
                XMLNode *part;
                for (part = root->FirstChild(); part != 0; part = part->NextSibling())
                {
                    if (part->ToElement())
                    {
                        if (stricmp(part->Value(), "Plugin") == 0)
                        {
                            const char *dll = ((XMLElement*)part)->Attribute("dll");
                            DLLHANDLETYPE h = opendll(dll);
                            if (h)
                            {
                                getatanuadllinfoproc getdllinfo = (getatanuadllinfoproc)getdllproc(h, "getatanuadllinfo");
                                if (getdllinfo)
                                {
                                    atanuadllinfo *dllinfo = new atanuadllinfo;
                                    getdllinfo(dllinfo);
                                    if (dllinfo->mDllVersion <= ATANUA_PLUGIN_DLL_VERSION)
                                    {
                                        mDllInfo.push_back(dllinfo);
                                        mDllHandle.push_back(h);
                                    }
                                    else
                                    {
                                        char temp[512];
                                        sprintf(temp, "Plug-in \"%s\" version is incompatible \n"
                                                     "with the current version of Atanua.\n"
                                                     "\n"
                                                     "Try to use it anyway?", dll);
                                        if (okcancel(temp))
                                        {
                                            mDllInfo.push_back(dllinfo);
                                            mDllHandle.push_back(h);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:LDVSOFT,项目名称:atanua,代码行数:61,代码来源:pluginchipfactory.cpp

示例13: open


//.........这里部分代码省略.........
	{
		XMLNode *node = root->FirstChild();

		// Loop over all properties
		while(node != NULL)
		{
			XMLElement *element = node->ToElement();

			if(element == NULL)
			{
				m_last_error = "Configuration file is invalid!";
				return true;
			}

			// Get name and type (attributes)
			const char* tmp_name = element->Attribute("name");
			const char* tmp_type = element->Attribute("type");

			if(tmp_name == NULL || tmp_type == NULL)
			{
				m_last_error = "Configuration file is invalid!";
				return true;
			}

			string name(tmp_name);
			string type(tmp_type);

			// Get text
			const char* tmp_text = element->GetText();
			string text = "";

			if(tmp_text != NULL)
				text = tmp_text;

			// Set property
			if(type == "string")
			{
				if(setStringProperty(name, text))
					return true;
			}
			else if(type == "int")
			{
				int value;
				if(stringToInt(text, &value))
				{
					m_last_error = "Error in configuration: " + text + " should be an integer";
					return true;
				}

				if(setIntProperty(name, value))
					return true;
			}
			else if(type == "double")
			{
				double value;
				if(stringToDouble(text, &value))
				{
					m_last_error = "Error in configuration: " + text + " should be a double";
					return true;
				}

				if(setDoubleProperty(name, value))
					return true;
			}
			else if(type == "bool")
			{
				bool value;
				if(text == "1")
					value = true;
				else if(text == "0")
					value = false;
				else
				{
					m_last_error = "Error in configuration: " + text + " should be boolean (0 or 1)";
					return true;
				}

				if(setBoolProperty(name, value))
					return true;
			}
			else
			{
				m_last_error = "Error in configuration: " + type + " is not a valid type";
				return true;
			}

			// Next node
			node = node->NextSibling();
		}
	}
	else
	{
		m_last_error = "File contains not the configuration of a fractal with ID " + m_id;
		return true;
	}

	resetDirty();

	return false;
}
开发者ID:svenhertle,项目名称:fractalimages,代码行数:101,代码来源:FractalConfiguration.cpp

示例14: main

int main()
{
	
	bool soundFlag = false;
	std::string headlines[3000];
	int strCount = 0;
	bool storyExists = false;
	int pageSwitch = 0;
while (true){
	std::ofstream a_file ( "ESPN_NEWS.txt", std::ios::app );
	CURL *curl;
    FILE *fp;
    CURLcode res;
	if (pageSwitch==0){
		char *url = "http://sports.espn.go.com/espn/rss/news";
		char outfilename[FILENAME_MAX] = "input3.xml";
	    curl = curl_easy_init();
	    if (curl) {
			fp = fopen(outfilename,"wb");
			curl_easy_setopt(curl, CURLOPT_URL, url);
			curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
			curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
			res = curl_easy_perform(curl);
			curl_easy_cleanup(curl);
			fclose(fp);
	   }
	}
	else if(pageSwitch==1){
		char *url = "http://sports.espn.go.com/espn/rss/nfl/news";
		char outfilename[FILENAME_MAX] = "input3.xml";
		curl = curl_easy_init();
		if (curl) {
		     fp = fopen(outfilename,"wb");
			 curl_easy_setopt(curl, CURLOPT_URL, url);
			 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
			 curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
			 res = curl_easy_perform(curl);
			 curl_easy_cleanup(curl);
			 fclose(fp);
		}
	}
	else if(pageSwitch==2){
		char *url = "http://sports.espn.go.com/espn/rss/nba/news";
		char outfilename[FILENAME_MAX] = "input3.xml";
	    curl = curl_easy_init();
	    if (curl) {
		 fp = fopen(outfilename,"wb");
		 curl_easy_setopt(curl, CURLOPT_URL, url);
		 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
		 curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
		 res = curl_easy_perform(curl);
		 curl_easy_cleanup(curl);
		 fclose(fp);
		}
	}
	else{
	  char *url = "http://sports.espn.go.com/espn/rss/espnu/news";
	  char outfilename[FILENAME_MAX] = "input3.xml";
	  curl = curl_easy_init();
	  if (curl) {
        fp = fopen(outfilename,"wb");
        curl_easy_setopt(curl, CURLOPT_URL, url);
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
        res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
        fclose(fp);
	  }
	}

	////////////////////////////////////////////////////////////////
	bool loopFlag = true;
	bool bigLoop = true;
	
    tinyxml2::XMLDocument doc;
    doc.LoadFile( "input3.xml" );
	XMLNode *rootnode = doc.FirstChild();
	//////////////////////////////
	rootnode = rootnode->NextSibling();
	rootnode = rootnode->FirstChild();////////////hard code to get past the xml header into <ITEM> </ITEM portion
	rootnode = rootnode->FirstChild();
	rootnode = rootnode->NextSibling();
	///////////////////////////////////
	
	while(loopFlag==true){
		if(std::strcmp(rootnode->Value(),"item") != 0){   
			rootnode = rootnode->NextSibling();
		}
		else 
			loopFlag=false;
	}


	while(bigLoop==true){
		XMLHandle safe = rootnode;
		if(safe.ToNode()==NULL)
			bigLoop=false;
		else{
			NewsEntry *story = new NewsEntry(); 
			rootnode = rootnode->FirstChild();
//.........这里部分代码省略.........
开发者ID:jakeb15,项目名称:ESPN_XML,代码行数:101,代码来源:ESPN_XML.cpp

示例15: main


//.........这里部分代码省略.........
		int result = doc->FirstChildElement()->LastChildElement()->QueryIntAttribute( "attrib", &value );
		XMLTest( "Programmatic DOM", result, (int)XML_NO_ATTRIBUTE );
		XMLTest( "Programmatic DOM", value, 10 );

		doc->Print();

		{
			XMLPrinter streamer;
			doc->Print( &streamer );
			printf( "%s", streamer.CStr() );
		}
		{
			XMLPrinter streamer( 0, true );
			doc->Print( &streamer );
			XMLTest( "Compact mode", "<element><sub attrib=\"1\"/><sub/></element>", streamer.CStr(), false );
		}
		doc->SaveFile( "./resources/out/pretty.xml" );
		doc->SaveFile( "./resources/out/compact.xml", true );
		delete doc;
	}
	{
		// Test: Dream
		// XML1 : 1,187,569 bytes	in 31,209 allocations
		// XML2 :   469,073	bytes	in    323 allocations
		//int newStart = gNew;
		XMLDocument doc;
		doc.LoadFile( "resources/dream.xml" );

		doc.SaveFile( "resources/out/dreamout.xml" );
		doc.PrintError();

		XMLTest( "Dream", "xml version=\"1.0\"",
						  doc.FirstChild()->ToDeclaration()->Value() );
		XMLTest( "Dream", true, doc.FirstChild()->NextSibling()->ToUnknown() ? true : false );
		XMLTest( "Dream", "DOCTYPE PLAY SYSTEM \"play.dtd\"",
						  doc.FirstChild()->NextSibling()->ToUnknown()->Value() );
		XMLTest( "Dream", "And Robin shall restore amends.",
						  doc.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );
		XMLTest( "Dream", "And Robin shall restore amends.",
						  doc.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );

		XMLDocument doc2;
		doc2.LoadFile( "resources/out/dreamout.xml" );
		XMLTest( "Dream-out", "xml version=\"1.0\"",
						  doc2.FirstChild()->ToDeclaration()->Value() );
		XMLTest( "Dream-out", true, doc2.FirstChild()->NextSibling()->ToUnknown() ? true : false );
		XMLTest( "Dream-out", "DOCTYPE PLAY SYSTEM \"play.dtd\"",
						  doc2.FirstChild()->NextSibling()->ToUnknown()->Value() );
		XMLTest( "Dream-out", "And Robin shall restore amends.",
						  doc2.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );

		//gNewTotal = gNew - newStart;
	}


	{
		const char* error =	"<?xml version=\"1.0\" standalone=\"no\" ?>\n"
							"<passages count=\"006\" formatversion=\"20020620\">\n"
							"    <wrong error>\n"
							"</passages>";

		XMLDocument doc;
		doc.Parse( error );
		XMLTest( "Bad XML", doc.ErrorID(), XML_ERROR_PARSING_ATTRIBUTE );
	}
开发者ID:AlejandorLazaro,项目名称:tinyxml2,代码行数:66,代码来源:xmltest.cpp


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