+ for ( wxXmlResourceDataRecords::const_iterator i = files.begin();
+ i != files.end(); ++i )
+ {
+ if ( (*i)->Doc->GetRoot() == root )
+ {
+ return (*i)->File;
+ }
+ }
+
+ return wxEmptyString; // not found
+}
+
+} // anonymous namespace
+
+void wxXmlResource::ReportError(wxXmlNode *context, const wxString& message)
+{
+ if ( !context )
+ {
+ DoReportError("", NULL, message);
+ return;
+ }
+
+ // We need to find out the file that 'context' is part of. Performance of
+ // this code is not critical, so we simply find the root XML node and
+ // compare it with all loaded XRC files.
+ const wxString filename = GetFileNameFromNode(context, Data());
+
+ DoReportError(filename, context, message);
+}
+
+void wxXmlResource::DoReportError(const wxString& xrcFile, wxXmlNode *position,
+ const wxString& message)
+{
+ const int line = position ? position->GetLineNumber() : -1;
+
+ wxString loc;
+ if ( !xrcFile.empty() )
+ loc = xrcFile + ':';
+ if ( line != -1 )
+ loc += wxString::Format("%d:", line);
+ if ( !loc.empty() )
+ loc += ' ';
+
+ wxLogError("XRC error: %s%s", loc, message);
+}
+
+
+//-----------------------------------------------------------------------------
+// XRCID implementation
+//-----------------------------------------------------------------------------