private string RenderSpecificXML(KBUserDetailInfo currentUser, int documentId, int documentVersionId) { XmlValidator validator = new XmlValidator(); string fileName = string.Empty; string uiLanguage = currentUserOutputConfig.UILanguage; SourceFileInfo[] sfis = documentService.GetFiles(currentUser, documentId, documentVersionId); if (sfis != null && sfis.Length > 0) { ArrayList xmlBuffer = new ArrayList(); //先驗證延伸檔名 foreach (SourceFileInfo sfi in sfis) { if (validator.ValidateExtension(sfi.DisplayName)) { xmlBuffer.Add(sfi); } } //通過延伸檔名考驗的再驗證內容格式 for (int i = 0; i < xmlBuffer.Count; i++) { SourceFileInfo sfi = (SourceFileInfo)xmlBuffer[i]; string body = validator.GetFileBody(sfi.CurrentPath); bool validateXML = validator.ValidateXML(body, uiLanguage); if (validateXML) { string xslt = validator.DigXslt(body, uiLanguage); if (!string.IsNullOrEmpty(xslt)) { fileName = sfi.DisplayName; break; //碰到第一個通過的以下的就不再驗證了 } } } } return fileName; }