+// find all files mentioned in structure, e.g. <bitmap>filename</bitmap>
+void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxString& inputPath)
+{
+ wxXmlNode *n = node;
+ if (n == NULL) return;
+ n = n->GetChildren();
+
+ while (n)
+ {
+ if ((node->GetType() == wxXML_ELEMENT_NODE) &&
+ // parent is an element, i.e. has subnodes...
+ (n->GetType() == wxXML_TEXT_NODE ||
+ n->GetType() == wxXML_CDATA_SECTION_NODE) &&
+ // ...it is textnode...
+ (node/*not n!*/->GetName() == "bitmap"))
+ // ...and known to contain filename
+ {
+ wxString fullname;
+ wxString filename = n->GetContent();
+ if (wxIsAbsolutePath(n->GetContent())) fullname = n->GetContent();
+ else fullname = inputPath + "/" + n->GetContent();
+
+ filename.Replace("/", "_");
+ filename.Replace("\\", "_");
+ filename.Replace("*", "_");
+ filename.Replace("?", "_");
+ n->SetContent(filename);
+
+ if (flagVerbose)
+ wxPrintf("adding " + filename + "...\n");
+
+ flist.Add(filename);
+
+ wxFileInputStream sin(fullname);
+ wxFileOutputStream sout(parOutputPath + "/" + filename);
+ sin.Read(sout); // copy the stream
+ }
+
+ // subnodes:
+ if (n->GetType() == wxXML_ELEMENT_NODE)
+ FindFilesInXML(n, flist, inputPath);
+
+ n = n->GetNext();
+ }
+}
+
+
+