Help Loading XML in JQuery Core object: Discrepancies between FF 3.0 and IE 7.0
I'm new to JQuery but am trying to use it in perhaps an advanced way:
to process XML returned from a SharePoint Web service. It works for FF
3.0 but not IE 7.0.
The discrepancy is that when I create a JQuery object from the xmlhttp
response text (the XML returned by the service), and then view the
innerHTML property of the JQuery object, it looks fine in FF, but it
is an empty string in IE.
Here's what I'm doing after I get the response from the service:
this.jXml = $(this.xmlhttp.responseText);
alert(this.jXml[0].innerHTML)
In FF this shows the response text without the XML document type
declaration and the <soap:Envelope> element. I'm able to use
this.jXml.find() to grab the elements I want from the response text
and all is well.
But in IE, this.jXml[0].innerHTML returns an *empty string* (!). On a
hunch I tried to increment the array index by one with
this.jXml[1].innerHTML. *This returns null in FF*, but surprisingly in
IE it returns a subset of the XML response text, one that does not
play nice with this.jXml.find().
Here's the XML response I'm getting from the server for both FF and
IE:
-----------------------
<?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="10">
<z:row ows_ID='1'
ows_ContentTypeId='0x01006F46D49AC42673439388587518C8D604'
ows_ContentType='Item' ows_Title='Competency/specialization
requirements' ows_Modified='2008-07-26 13:27:57'
ows_Created='2008-07-26 13:27:33' ows_Author='1;#VM-
WS2K3\Administrator' ows_Editor='1;#VM-WS2K3\Administrator'
ows_owshiddenversion='2' ows_WorkflowVersion='1' ows__UIVersion='512'
ows__UIVersionString='1.0' ows_Attachments='0'
ows__ModerationStatus='0' ows_LinkTitleNoMenu='Competency/
specialization requirements' ows_LinkTitle='Competency/specialization
requirements' ows_SelectTitle='1' ows_Order='100.000000000000'
ows_GUID='{9BD7420A-2BF1-4379-8B39-83571B95198E}'
ows_FileRef='1;#Lists/Common Scenarios/1_.000'
ows_FileDirRef='1;#Lists/Common Scenarios'
ows_Last_x0020_Modified='1;#2008-07-26 13:27:33'
ows_Created_x0020_Date='1;#2008-07-26 13:27:33' ows_FSObjType='1;#0'
ows_PermMask='0x7fffffffffffffff' ows_FileLeafRef='1;#1_.000'
ows_UniqueId='1;#{5068826B-B8D7-4CCC-8B19-92E41393D3EF}'
ows_ProgId='1;#'
ows_ScopeId='1;#{E0666CA7-7F00-4995-9209-2EB95B543E15}'
ows__EditMenuTableStart='1_.000' ows__EditMenuTableEnd='1'
ows_LinkFilenameNoMenu='1_.000' ows_LinkFilename='1_.000'
ows_ServerUrl='/Lists/Common Scenarios/1_.000'
ows_EncodedAbsUrl='http://vm-ws2k3/Lists/Common%20Scenarios/1_.000'
ows_BaseName='1_' ows_MetaInfo='1;#' ows__Level='1'
ows__IsCurrentVersion='1' />
<z:row ows_ID='2'
ows_ContentTypeId='0x01006F46D49AC42673439388587518C8D604'
ows_ContentType='Item' ows_Title='Launch new competency or
specialization' ows_Modified='2008-07-26 13:27:42'
ows_Created='2008-07-26 13:27:42' ows_Author='1;#VM-
WS2K3\Administrator' ows_Editor='1;#VM-WS2K3\Administrator'
ows_owshiddenversion='1' ows_WorkflowVersion='1' ows__UIVersion='512'
ows__UIVersionString='1.0' ows_Attachments='0'
ows__ModerationStatus='0' ows_LinkTitleNoMenu='Launch new competency
or specialization' ows_LinkTitle='Launch new competency or
specialization' ows_SelectTitle='2' ows_Order='200.000000000000'
ows_GUID='{0DDDA6F0-FCD0-49A9-8BE0-ACDAC718B9E3}'
ows_FileRef='2;#Lists/Common Scenarios/2_.000'
ows_FileDirRef='2;#Lists/Common Scenarios'
ows_Last_x0020_Modified='2;#2008-07-26 13:27:42'
ows_Created_x0020_Date='2;#2008-07-26 13:27:42' ows_FSObjType='2;#0'
ows_PermMask='0x7fffffffffffffff' ows_FileLeafRef='2;#2_.000'
ows_UniqueId='2;#{8069B759-C1BA-4A6E-85B3-3FCEB72FF0DB}'
ows_ProgId='2;#'
ows_ScopeId='2;#{E0666CA7-7F00-4995-9209-2EB95B543E15}'
ows__EditMenuTableStart='2_.000' ows__EditMenuTableEnd='2'
ows_LinkFilenameNoMenu='2_.000' ows_LinkFilename='2_.000'
ows_ServerUrl='/Lists/Common Scenarios/2_.000'
ows_EncodedAbsUrl='http://vm-ws2k3/Lists/Common%20Scenarios/2_.000'
ows_BaseName='2_' ows_MetaInfo='2;#' ows__Level='1'
ows__IsCurrentVersion='1' />
<z:row ows_ID='3'
ows_ContentTypeId='0x01006F46D49AC42673439388587518C8D604'
ows_ContentType='Item' ows_Title='Exam recency'
ows_Modified='2008-07-26 13:28:28' ows_Created='2008-07-26 13:28:28'
ows_Author='1;#VM-WS2K3\Administrator' ows_Editor='1;#VM-
WS2K3\Administrator' ows_owshiddenversion='1' ows_WorkflowVersion='1'
ows__UIVersion='512' ows__UIVersionString='1.0' ows_Attachments='0'
ows__ModerationStatus='0' ows_LinkTitleNoMenu='Exam recency'
ows_LinkTitle='Exam recency' ows_SelectTitle='3'
ows_Order='300.000000000000' ows_GUID='{F3F56519-A8C1-429B-90D2-
C2A0BF018377}' ows_FileRef='3;#Lists/Common Scenarios/3_.000'
ows_FileDirRef='3;#Lists/Common Scenarios'
ows_Last_x0020_Modified='3;#2008-07-26 13:28:28'
ows_Created_x0020_Date='3;#2008-07-26 13:28:28' ows_FSObjType='3;#0'
ows_PermMask='0x7fffffffffffffff' ows_FileLeafRef='3;#3_.000'
ows_UniqueId='3;#{CB28E48A-00A3-4E0E-A236-9DCED2362222}'
ows_ProgId='3;#'
ows_ScopeId='3;#{E0666CA7-7F00-4995-9209-2EB95B543E15}'
ows__EditMenuTableStart='3_.000' ows__EditMenuTableEnd='3'
ows_LinkFilenameNoMenu='3_.000' ows_LinkFilename='3_.000'
ows_ServerUrl='/Lists/Common Scenarios/3_.000'
ows_EncodedAbsUrl='http://vm-ws2k3/Lists/Common%20Scenarios/3_.000'
ows_BaseName='3_' ows_MetaInfo='3;#' ows__Level='1'
ows__IsCurrentVersion='1' />
</rs:data>
</listitems></GetListItemsResult></GetListItemsResponse></soap:Body></
soap:Envelope>
-----------------------
As I said, when this is put into a JQuery object in FF, it appears to
only strip out the document declaration and the <soap:Envelope>
element. In IE, however, this.jXml[1].innerHTML returns only the
<z:row> elements, and inserts </Z> before each <z:row> element:
----------------------
</Z><z:row ows_ID='1'
ows_ContentTypeId='0x01006F46D49AC42673439388587518C8D604'
ows_ContentType='Item' ows_Title='Competency/specialization
requirements' ows_Modified='2008-07-26 13:27:57'
ows_Created='2008-07-26 13:27:33' ows_Author='1;#VM-
WS2K3\Administrator' ows_Editor='1;#VM-WS2K3\Administrator'
ows_owshiddenversion='2' ows_WorkflowVersion='1' ows__UIVersion='512'
ows__UIVersionString='1.0' ows_Attachments='0'
ows__ModerationStatus='0' ows_LinkTitleNoMenu='Competency/
specialization requirements' ows_LinkTitle='Competency/specialization
requirements' ows_SelectTitle='1' ows_Order='100.000000000000'
ows_GUID='{9BD7420A-2BF1-4379-8B39-83571B95198E}'
ows_FileRef='1;#Lists/Common Scenarios/1_.000'
ows_FileDirRef='1;#Lists/Common Scenarios'
ows_Last_x0020_Modified='1;#2008-07-26 13:27:33'
ows_Created_x0020_Date='1;#2008-07-26 13:27:33' ows_FSObjType='1;#0'
ows_PermMask='0x7fffffffffffffff' ows_FileLeafRef='1;#1_.000'
ows_UniqueId='1;#{5068826B-B8D7-4CCC-8B19-92E41393D3EF}'
ows_ProgId='1;#'
ows_ScopeId='1;#{E0666CA7-7F00-4995-9209-2EB95B543E15}'
ows__EditMenuTableStart='1_.000' ows__EditMenuTableEnd='1'
ows_LinkFilenameNoMenu='1_.000' ows_LinkFilename='1_.000'
ows_ServerUrl='/Lists/Common Scenarios/1_.000'
ows_EncodedAbsUrl='http://vm-ws2k3/Lists/Common%20Scenarios/1_.000'
ows_BaseName='1_' ows_MetaInfo='1;#' ows__Level='1'
ows__IsCurrentVersion='1' />
</Z><z:row ows_ID='2'
ows_ContentTypeId='0x01006F46D49AC42673439388587518C8D604'
ows_ContentType='Item' ows_Title='Launch new competency or
specialization' ows_Modified='2008-07-26 13:27:42'
ows_Created='2008-07-26 13:27:42' ows_Author='1;#VM-
WS2K3\Administrator' ows_Editor='1;#VM-WS2K3\Administrator'
ows_owshiddenversion='1' ows_WorkflowVersion='1' ows__UIVersion='512'
ows__UIVersionString='1.0' ows_Attachments='0'
ows__ModerationStatus='0' ows_LinkTitleNoMenu='Launch new competency
or specialization' ows_LinkTitle='Launch new competency or
specialization' ows_SelectTitle='2' ows_Order='200.000000000000'
ows_GUID='{0DDDA6F0-FCD0-49A9-8BE0-ACDAC718B9E3}'
ows_FileRef='2;#Lists/Common Scenarios/2_.000'
ows_FileDirRef='2;#Lists/Common Scenarios'
ows_Last_x0020_Modified='2;#2008-07-26 13:27:42'
ows_Created_x0020_Date='2;#2008-07-26 13:27:42' ows_FSObjType='2;#0'
ows_PermMask='0x7fffffffffffffff' ows_FileLeafRef='2;#2_.000'
ows_UniqueId='2;#{8069B759-C1BA-4A6E-85B3-3FCEB72FF0DB}'
ows_ProgId='2;#'
ows_ScopeId='2;#{E0666CA7-7F00-4995-9209-2EB95B543E15}'
ows__EditMenuTableStart='2_.000' ows__EditMenuTableEnd='2'
ows_LinkFilenameNoMenu='2_.000' ows_LinkFilename='2_.000'
ows_ServerUrl='/Lists/Common Scenarios/2_.000'
ows_EncodedAbsUrl='http://vm-ws2k3/Lists/Common%20Scenarios/2_.000'
ows_BaseName='2_' ows_MetaInfo='2;#' ows__Level='1'
ows__IsCurrentVersion='1' />
</Z><z:row ows_ID='3'
ows_ContentTypeId='0x01006F46D49AC42673439388587518C8D604'
ows_ContentType='Item' ows_Title='Exam recency'
ows_Modified='2008-07-26 13:28:28' ows_Created='2008-07-26 13:28:28'
ows_Author='1;#VM-WS2K3\Administrator' ows_Editor='1;#VM-
WS2K3\Administrator' ows_owshiddenversion='1' ows_WorkflowVersion='1'
ows__UIVersion='512' ows__UIVersionString='1.0' ows_Attachments='0'
ows__ModerationStatus='0' ows_LinkTitleNoMenu='Exam recency'
ows_LinkTitle='Exam recency' ows_SelectTitle='3'
ows_Order='300.000000000000' ows_GUID='{F3F56519-A8C1-429B-90D2-
C2A0BF018377}' ows_FileRef='3;#Lists/Common Scenarios/3_.000'
ows_FileDirRef='3;#Lists/Common Scenarios'
ows_Last_x0020_Modified='3;#2008-07-26 13:28:28'
ows_Created_x0020_Date='3;#2008-07-26 13:28:28' ows_FSObjType='3;#0'
ows_PermMask='0x7fffffffffffffff' ows_FileLeafRef='3;#3_.000'
ows_UniqueId='3;#{CB28E48A-00A3-4E0E-A236-9DCED2362222}'
ows_ProgId='3;#'
ows_ScopeId='3;#{E0666CA7-7F00-4995-9209-2EB95B543E15}'
ows__EditMenuTableStart='3_.000' ows__EditMenuTableEnd='3'
ows_LinkFilenameNoMenu='3_.000' ows_LinkFilename='3_.000'
ows_ServerUrl='/Lists/Common Scenarios/3_.000'
ows_EncodedAbsUrl='http://vm-ws2k3/Lists/Common%20Scenarios/3_.000'
ows_BaseName='3_' ows_MetaInfo='3;#' ows__Level='1'
ows__IsCurrentVersion='1' />
------------------------
Can anyone help me understand what's going wrong here? Should I try a
different approach to loading XML returned from a Web service using
JQuery? I'm glad I have this working in FF, but unfortunately my
client will be using IE 7 almost exclusively, so if I'm going to use
JQuery on this project I really have to get this resolved.
Thank you!!