/// <summary>
        /// This method is used to fetch editor table on the specified file.
        /// </summary>
        /// <param name="file">Specify the file URL.</param>
        /// <returns>Return the editors table on the file if the server support the editor tables, otherwise return null.</returns>
        protected EditorsTable FetchEditorTable(string file)
        {
            if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 2053, this.Site))
            {
                // Call QueryEditorsTable to get editors table
                this.InitializeContext(file, this.UserName01, this.Password01, this.Domain);
                CellSubRequestType  cellSubRequestEditorsTable      = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryEditorsTable(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID());
                CellStorageResponse cellStorageResponseEditorsTable = this.Adapter.CellStorageRequest(file, new SubRequestType[] { cellSubRequestEditorsTable });
                CellSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(cellStorageResponseEditorsTable, 0, 0, this.Site);
                FsshttpbResponse    queryEditorsTableResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(subResponse, this.Site);

                // Get EditorsTable
                EditorsTable editorsTable = EditorsTableUtils.GetEditorsTableFromResponse(queryEditorsTableResponse, this.Site);

                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    // If can fetch the editors table, then the following requirement can be directly captured.
                    this.Site.CaptureRequirement(
                        "MS-FSSHTTP",
                        2053,
                        @"[In Appendix B: Product Behavior]  Implementation does represent the editors table as a compressed XML fragment. (<42> Section 3.1.4.8: On servers running Office 2013, the editors table is represented as a compressed XML fragment.)");
                }

                return(editorsTable);
            }

            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get EditorsTable from response xml.
        /// </summary>
        /// <param name="responseXml">The response xml about EditorsTable.</param>
        /// <returns>The instance of EditorsTable.</returns>
        public static EditorsTable GetEditorsTable(string responseXml)
        {
            responseXml = System.Text.RegularExpressions.Regex.Replace(responseXml, "^[^<]", string.Empty);
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(responseXml);
            XmlNodeList   nodeList = doc.GetElementsByTagName("Editor");
            List <Editor> list     = new List <Editor>();

            if (nodeList.Count > 0)
            {
                foreach (XmlNode node in nodeList)
                {
                    list.Add(GetEditor(node));
                }
            }

            EditorsTable table = new EditorsTable();

            table.Editors = list.ToArray();

            return(table);
        }