private static void insertXmlContentInNamedQueriesFile(SourceFile namedQueriesXmlFile, string xmlContent) { TextDocument namedQueriesXmlDocument = namedQueriesXmlFile.Document as TextDocument; DXXmlElement hibernateMappingTag = (namedQueriesXmlFile.FindChildByName("hibernate-mapping") as DXXmlElement); if (hibernateMappingTag == null) { throw new Exception("<hibernate-mapping> tag not found in " + namedQueriesXmlFile.FilePath); } int insertLine = (hibernateMappingTag as DXHtmlElement).CloseTagNameRange.End.Line; namedQueriesXmlDocument.InsertLines(insertLine, new string[1] { xmlContent }); namedQueriesXmlDocument.FormatLine(insertLine); }