42{
43 sg_ifstream infile;
44 SGPath filename(XML_filename);
45 if (!filename.isNull()) {
46 if (filename.extension().empty())
47 filename.concat(".xml");
48 infile.open(filename);
49 if ( !infile.is_open()) {
50 if (verbose) std::cerr << "Could not open file: " << filename << std::endl;
51 return 0L;
52 }
53 } else {
54 std::cerr << "No filename given." << std::endl;
55 return 0L;
56 }
57 readXML(infile, fparse, filename.utf8Str());
58 Element* document = fparse.GetDocument();
59 infile.close();
60 return document;
61}