Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 将Sharepoint中的XML解析为jqGrid_Jquery_Xml_Sharepoint_Soap_Jqgrid - Fatal编程技术网

Jquery 将Sharepoint中的XML解析为jqGrid

Jquery 将Sharepoint中的XML解析为jqGrid,jquery,xml,sharepoint,soap,jqgrid,Jquery,Xml,Sharepoint,Soap,Jqgrid,我正在尝试从Sharepoint加载数据并在jqGrid中显示它。Sharepoint中的XML就是这种格式,我很难让jqGrid读取它。我已经阅读了jqGrid文档,但仍然无法让它工作 这是sharepoint的XML输出: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://w

我正在尝试从Sharepoint加载数据并在jqGrid中显示它。Sharepoint中的XML就是这种格式,我很难让jqGrid读取它。我已经阅读了jqGrid文档,但仍然无法让它工作

这是sharepoint的XML输出:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/"><GetListItemsResult><listitems xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
 xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
 xmlns:rs='urn:schemas-microsoft-com:rowset'
 xmlns:z='#RowsetSchema'>
    <rs:data ItemCount="1">
        <z:row ows_ID='16475' ows_Country='Denmark' ows_Reporting_Month='2012-MAR' ows_SourceID='test parent 1' ows_Created='2013-04-10 13:29:03' ows_Cluster='null' ows_NewOrUpdatedRecord='0' ows_RecordUpdate='0' />
    </rs:data></listitems></GetListItemsResult></GetListItemsResponse></soap:Body></soap:Envelope>

有人能帮我修复jqGrid代码以读取此XML格式吗?

从您提供给url属性的url中,我可以看到您正在从sharepoint(XML.txt)请求一些文件。这是有意的吗?因为您提供的响应是通过调用SharePoint Services而不是直接调用文件。如果您拥有SharePoint版本2010或2013,您可以考虑使用REST API从SharePoint获取数据,而在SharePoint中,JavaScript是更好的方法。不要使用jqGRid直接从Sharepoint检索数据,而是使用Microsoft REST API或某些第三方库,如或是,它旨在从XML文件读取数据。在尝试Ajax或其他更复杂的方法之前,我想先完成XML解析。我认为将XML保存在文本文件中并尝试将其加载到jqGrid是测试解析的最简单方法。你是说jqGrid无法像我尝试的那样加载XML.txt吗?请不要理会,我已经解决了。我使用的jQuery版本不兼容。
jQuery("#listXML").jqGrid({
    datatype: "xml",
    url: "https://collaboration.globalwealthmanagement.citigroup.net/sites/Compliance_Request_Log/SysCMD/XML.txt",
    height: 250,
    colNames: ['ID No', 'Country'],
    colModel: [
        {name: 'id', xmlmap:'[ows_ID]'},
        {name: 'country', xmlmap:'[ows_Country]'}
    ],
    xmlReader: {
      root: "rs\\:data",
      row: "z\\:row",
      repeatitems: false,
      id: "[ows_ID]"
    },

    multiselect: true,
    caption: "Test"
  });