My XML File has:
< Package > xmlMetadata < /Package >
I am searching for a tag in this file and the text between the startin
Getline doesn't search for a line it simply reads each line into the variable "line", you then have to search in that "line" for the text you want.
size_t found=line.find("Package");
if (found!=std::string::npos) {
cout << line;
BUT this is a bad way to handle XML - there is nothing stopping the XML writer from breaking the tag onto multiple lines. Unless this is a one off and you create the file you really should use a general XML parser to read the file and give you a list of tags.
There are a bunch of very easy to use XML parsers, such as TinyXML
EDIT (different xml now posted) - that's the problem with using regex to parse xml, you don't know how the xml will break lines. You can keep adding more and more layers of complexity until you have written your own xml parser - just use one of What is the best open XML parser for C++?