Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


can any one help to find a specific string between html tags
which is changed to a sting..
weather.html looks (for location) is
<location>somewhere</location>


#include <iostream>
#include <fstream>
#include <string>
using namespace std;

string find_field(string myPage,string);

int main (void) {

string page, line, location, temperature;
ifstream inputFile("weather.xml");

while(getline(inputFile, line)) {
page.append(line);
line.erase();
}
// Now page is a string that contains the whole xml page

// Here you need to write something that finds and
// extracts location and temperature from the XML
// data in the string page and stores them in
// the strings location and temperature respectively
location=find_field(page,"location");
temperature=find_field(page,"temp_c");

cout << "Location: "<<location << endl;
cout << "Temperature: " << temperature << endl;
system("pause");
}
string find_field(string myPage,string find_string){
int temp=myPage.find(find_string);
if(temp!=string::npos) {
cout << "Match found at " << temp << endl;

}

return "found?";
}

///


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More C++ General Interview Questions

Explain the difference between new() and malloc() in c++?

0 Answers  


Give an example of run-time polymorphism/virtual functions.

0 Answers  


What is the role of copy constructor in copying of thrown objects?

0 Answers  


What is c++ 11 and c++ 14?

0 Answers  


Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c

0 Answers  


Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == 4 ) y-= 7; else y = 8; Enter a segment of code (without any IF statements) that does exectly the same thing using the switch structure.

1 Answers  


How many pointers are required to reverse a link list?

5 Answers   CTS,


Write bites in Turbo c++ Header ("Include") Files.

0 Answers  


What is the use of register keyword with the variables?

0 Answers  


Mention the ways in which parameterized can be invoked. Give an example of each.

0 Answers  


How do I exit turbo c++?

0 Answers  


What is an incomplete type in c++?

0 Answers  


Categories