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
Explain the difference between new() and malloc() in c++?
Give an example of run-time polymorphism/virtual functions.
What is the role of copy constructor in copying of thrown objects?
What is c++ 11 and c++ 14?
Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c
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.
How many pointers are required to reverse a link list?
Write bites in Turbo c++ Header ("Include") Files.
What is the use of register keyword with the variables?
Mention the ways in which parameterized can be invoked. Give an example of each.
How do I exit turbo c++?
What is an incomplete type in c++?