这个类型下面的Web服务响应是什么?

时间:2015-11-17 11:30:27

标签: c# xml web-services sharepoint

我有sharePoint 2013服务器,我编写了简单的c#项目并将sharePoint“List.asmx”添加到项目中,但我不知道Web服务响应的格式是什么(调用“GetListItem”方法)?! 如何将此响应文本转换为标准XML?

My C# code

Sample of response text

回应文本样本:

<rs:data ItemCount=\"4\" xmlns:rs=\"urn:schemas-microsoft-com:rowset\">
  \n   
  <z:row ows_ContentTypeId=\"0x0100EEB6E1271CFA184BB3C48AB468777F8A\" ows_Title=\"RecOne\" ows_ed0n=\"12\" ows_jf2g=\"http://google.com\" ows_ieio=\"32\" ows_ID=\"1\" ows_ContentType=\"Item\" ows_Modified=\"2015-11-02 12:28:26\" ows_Created=\"2015-11-02 12:26:26\" ows_Author=\"1073741823;#System Account\" ows_Editor=\"1073741823;#System Account\" ows_owshiddenversion=\"3\" ows_WorkflowVersion=\"1\" ows__UIVersion=\"512\" ows__UIVersionString=\"1.0\" ows_Attachments=\"0\" ows__ModerationStatus=\"0\" ows_LinkTitleNoMenu=\"RecOne\" ows_LinkTitle=\"RecOne\" ows_LinkTitle2=\"RecOne\" ows_SelectTitle=\"1\" ows_Order=\"100.000000000000\" ows_GUID=\"{E30D75D2-2DED-458F-9365-FFA349AB6A05}\" ows_FileRef=\"1;#sites/hasan/Lists/myList/1_.000\" ows_FileDirRef=\"1;#sites/hasan/Lists/myList\" ows_Last_x0020_Modified=\"1;#2015-11-02 12:26:26\" ows_Created_x0020_Date=\"1;#2015-11-02 12:26:26\" ows_FSObjType=\"1;#0\" ows_SortBehavior=\"1;#0\" ows_PermMask=\"0x7fffffffffffffff\" ows_FileLeafRef=\"1;#1_.000\" ows_UniqueId=\"1;#{602E7632-0DF0-4AFA-883E-6C6B6ADD2577}\" ows_ProgId=\"1;#\" ows_ScopeId=\"1;#{1D5C0084-ECFA-442A-BA37-1BD88E075A91}\" ows__EditMenuTableStart=\"1_.000\" ows__EditMenuTableStart2=\"1\" ows__EditMenuTableEnd=\"1\" ows_LinkFilenameNoMenu=\"1_.000\" ows_LinkFilename=\"1_.000\" ows_LinkFilename2=\"1_.000\" ows_ServerUrl=\"/sites/hasan/Lists/myList/1_.000\" ows_EncodedAbsUrl=\"http://win-gujmfkgm8ns/sites/hasan/Lists/myList/1_.000\" ows_BaseName=\"1_\" ows_MetaInfo=\"1;#\" ows__Level=\"1\" ows__IsCurrentVersion=\"1\" ows_ItemChildCount=\"1;#0\" ows_FolderChildCount=\"1;#0\" xmlns:z=\"#RowsetSchema\" />\n   </rs:data>\n"

1 个答案:

答案 0 :(得分:1)

我就这样做了:

            XmlNamespaceManager nsmgr = new XmlNamespaceManager(pkk.OwnerDocument.NameTable);

            nsmgr.AddNamespace("rs", "urn:schemas-microsoft-com:rowset");
            nsmgr.AddNamespace("z", "#RowsetSchema");

            foreach (XmlNode node in pkk.SelectNodes("rs:data/z:row", nsmgr))
            {
              var title= node.Attributes["ows_Title"].Value;
              ...
            }