31 #ifndef FGXMLFILEREAD_HEADER_H 32 #define FGXMLFILEREAD_HEADER_H 41 #include "input_output/FGXMLParse.h" 42 #include "simgear/misc/sg_path.hxx" 43 #include "simgear/io/iostreams/sgstream.hxx" 49 #define ID_XMLFILEREAD "$Id: FGXMLFileRead.h,v 1.10 2017/02/25 14:23:18 bcoconni Exp $" 62 Element* LoadXMLDocument(
const SGPath& XML_filename,
bool verbose=
true)
64 return LoadXMLDocument(XML_filename, file_parser, verbose);
67 Element* LoadXMLDocument(
const SGPath& XML_filename,
FGXMLParse& fparse,
bool verbose=
true)
70 SGPath filename(XML_filename);
72 if (!filename.isNull()) {
73 if (filename.extension().empty())
74 filename.concat(
".xml");
76 infile.open(filename);
77 if ( !infile.is_open()) {
78 if (verbose) std::cerr <<
"Could not open file: " << filename << std::endl;
82 std::cerr <<
"No filename given." << std::endl;
86 readXML(infile, fparse, filename.utf8Str());
87 Element* document = fparse.GetDocument();
93 void ResetParser(
void) {file_parser.reset();}
Encapsulates an XML parser based on the EasyXML parser from the SimGear library.