bool CXMLDocumentFile::ResolveIncludes() { CXMLElement* pInclude = nullptr; while ((pInclude = (CXMLElement*)(this->DescendantsNamed(STRING("include")))) != 0) { CXMLAttribute* pFile = pInclude->AttributeNamed(STRING("file")); if (!pFile) { return false; } CFile File(m_pFile->Path() + STRING("\\") + pFile->ValueString()); if (File.Exists()) { CStreamFileRead ReadStream(File); CStreamReadTextGeneric ReadStreamText(ReadStream); CXMLDocument* pDocument = new CXMLDocument(ReadStreamText); if (pDocument) { //This replaces the include node with the root element node from the resolved document (severs the ties to the XML document object) pInclude->ReplaceWith(*pDocument->RootElementRetrieve()); delete pInclude; delete pDocument; } else { return false; } } else { return false; } } return true; }