Bug Tracker

Ticket #10377 (closed bug: wontfix)

Opened 3 years ago

Last modified 2 years ago

Cannot find elements of [nodeName='z:row'] in responseXML

Reported by: steve.workman@… Owned by: steve.workman@…
Priority: low Milestone: None
Component: selector Version: 1.7b1
Keywords: Cc:
Blocking: Blocked by:

Description

Hi, this is a regression from 1.6: I have some XML from a web service (generated by SharePoint 2007 web services) that are looking for rows of data. These are specified (and usually found by):

$(xData.responseXML).find("[nodeName='z:row']").each(function() {
// Do something
});

In 1.7b1 the "Do something" code is not being reached

This is a sample XML file

<?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="8">
   <z:row ows_ContentTypeId='0x0100DDB33E0A25E44140B53A905E8CD2C111' ows_Title='One' ows_DisplayName='One' ows_ID='1' ows_ContentType='Item' ows_Modified='2011-03-17 10:31:28' ows_Created='2010-06-14 15:20:20' ows_Author='462;#Workman, Steve' ows_Editor='363;#Keech, Victor' ows_owshiddenversion='7' ows_WorkflowVersion='1' ows__UIVersion='512' ows__UIVersionString='1.0' ows_Attachments='0' ows__ModerationStatus='0' ows_LinkTitleNoMenu='One' ows_LinkTitle='One' ows_SelectTitle='1' ows_Order='100.000000000000' ows_GUID='{37E1EF7B-7DCC-4390-87C4-FAF4315E3F5B}' ows_FileRef='1;#pdm/Lists/Segments/1_.000' ows_FileDirRef='1;#pdm/Lists/Segments' ows_Last_x0020_Modified='1;#2010-12-07 06:10:02' ows_Created_x0020_Date='1;#2010-12-07 06:10:02' ows_FSObjType='1;#0' ows_PermMask='0x7fffffffffffffff' ows_FileLeafRef='1;#1_.000' ows_UniqueId='1;#{CDB32DA8-BCD6-4F0D-A972-961AD1A3F2B5}' ows_ProgId='1;#' ows_ScopeId='1;#{0A8885B3-92F5-4F6B-A7E1-58FB7543BEB6}' ows__EditMenuTableStart='1_.000' ows__EditMenuTableEnd='1' ows_LinkFilenameNoMenu='1_.000' ows_LinkFilename='1_.000' ows_ServerUrl='/pdm/Lists/Segments/1_.000' ows_EncodedAbsUrl='http://example.com/pdm/Lists/Segments/1_.000' ows_BaseName='1_' ows_MetaInfo='1;#' ows__Level='1' ows__IsCurrentVersion='1' />
   <z:row ows_ContentTypeId='0x0100DDB33E0A25E44140B53A905E8CD2C111' ows_Title='Two' ows_DisplayName='Two' ows_ID='2' ows_ContentType='Item' ows_Modified='2010-06-14 15:20:31' ows_Created='2010-06-14 15:20:31' ows_Author='462;#Workman, Steve' ows_Editor='462;#Workman, Steve' ows_owshiddenversion='1' ows_WorkflowVersion='1' ows__UIVersion='512' ows__UIVersionString='1.0' ows_Attachments='0' ows__ModerationStatus='0' ows_LinkTitleNoMenu='Two' ows_LinkTitle='Two' ows_SelectTitle='2' ows_Order='200.000000000000' ows_GUID='{66F6BE42-BF5C-42C9-A8CE-4AE1E1644E20}' ows_FileRef='2;#pdm/Lists/Segments/2_.000' ows_FileDirRef='2;#pdm/Lists/Segments' ows_Last_x0020_Modified='2;#2010-12-07 06:10:06' ows_Created_x0020_Date='2;#2010-12-07 06:10:06' ows_FSObjType='2;#0' ows_PermMask='0x7fffffffffffffff' ows_FileLeafRef='2;#2_.000' ows_UniqueId='2;#{9EE493FF-D17B-473C-BAB8-B74E381615D6}' ows_ProgId='2;#' ows_ScopeId='2;#{0A8885B3-92F5-4F6B-A7E1-58FB7543BEB6}' ows__EditMenuTableStart='2_.000' ows__EditMenuTableEnd='2' ows_LinkFilenameNoMenu='2_.000' ows_LinkFilename='2_.000' ows_ServerUrl='/pdm/Lists/Segments/2_.000' ows_EncodedAbsUrl='http://example.com/pdm/Lists/Segments/2_.000' ows_BaseName='2_' ows_MetaInfo='2;#' ows__Level='1' ows__IsCurrentVersion='1' />
   <z:row ows_ContentTypeId='0x0100DDB33E0A25E44140B53A905E8CD2C111' ows_Title='Three' ows_DisplayName='Three' ows_ID='3' ows_ContentType='Item' ows_Modified='2010-06-14 15:20:41' ows_Created='2010-06-14 15:20:41' ows_Author='462;#Workman, Steve' ows_Editor='462;#Workman, Steve' ows_owshiddenversion='1' ows_WorkflowVersion='1' ows__UIVersion='512' ows__UIVersionString='1.0' ows_Attachments='0' ows__ModerationStatus='0' ows_LinkTitleNoMenu='Three' ows_LinkTitle='Three' ows_SelectTitle='3' ows_Order='300.000000000000' ows_GUID='{A5879457-3698-4A95-8A5C-B23E831D2D9D}' ows_FileRef='3;#pdm/Lists/Segments/3_.000' ows_FileDirRef='3;#pdm/Lists/Segments' ows_Last_x0020_Modified='3;#2010-12-07 06:10:07' ows_Created_x0020_Date='3;#2010-12-07 06:10:07' ows_FSObjType='3;#0' ows_PermMask='0x7fffffffffffffff' ows_FileLeafRef='3;#3_.000' ows_UniqueId='3;#{FAD5ED00-A0E6-4A4B-8F63-4580BB557575}' ows_ProgId='3;#' ows_ScopeId='3;#{0A8885B3-92F5-4F6B-A7E1-58FB7543BEB6}' ows__EditMenuTableStart='3_.000' ows__EditMenuTableEnd='3' ows_LinkFilenameNoMenu='3_.000' ows_LinkFilename='3_.000' ows_ServerUrl='/pdm/Lists/Segments/3_.000' ows_EncodedAbsUrl='http://example.com/pdm/Lists/Segments/3_.000' ows_BaseName='3_' ows_MetaInfo='3;#' ows__Level='1' ows__IsCurrentVersion='1' />
   <z:row ows_ContentTypeId='0x0100DDB33E0A25E44140B53A905E8CD2C111' ows_Title='Four' ows_DisplayName='Four' ows_ID='4' ows_ContentType='Item' ows_Modified='2010-09-09 13:49:47' ows_Created='2010-06-14 15:20:53' ows_Author='462;#Workman, Steve' ows_Editor='363;#Keech, Victor' ows_owshiddenversion='1' ows_WorkflowVersion='1' ows__UIVersion='512' ows__UIVersionString='1.0' ows_Attachments='0' ows__ModerationStatus='0' ows_LinkTitleNoMenu='Four' ows_LinkTitle='Four' ows_SelectTitle='4' ows_Order='400.000000000000' ows_GUID='{A874E89D-7CD6-4E87-BE6E-C392A1281576}' ows_FileRef='4;#pdm/Lists/Segments/4_.000' ows_FileDirRef='4;#pdm/Lists/Segments' ows_Last_x0020_Modified='4;#2010-12-07 06:10:08' ows_Created_x0020_Date='4;#2010-12-07 06:10:08' ows_FSObjType='4;#0' ows_PermMask='0x7fffffffffffffff' ows_FileLeafRef='4;#4_.000' ows_UniqueId='4;#{33D13964-274C-400F-9685-F47255393238}' ows_ProgId='4;#' ows_ScopeId='4;#{0A8885B3-92F5-4F6B-A7E1-58FB7543BEB6}' ows__EditMenuTableStart='4_.000' ows__EditMenuTableEnd='4' ows_LinkFilenameNoMenu='4_.000' ows_LinkFilename='4_.000' ows_ServerUrl='/pdm/Lists/Segments/4_.000' ows_EncodedAbsUrl='http://example.com/pdm/Lists/Segments/4_.000' ows_BaseName='4_' ows_MetaInfo='4;#' ows__Level='1' ows__IsCurrentVersion='1' />
   <z:row ows_ContentTypeId='0x0100DDB33E0A25E44140B53A905E8CD2C111' ows_Title='Five' ows_DisplayName='Five' ows_ID='5' ows_ContentType='Item' ows_Modified='2010-06-14 15:21:08' ows_Created='2010-06-14 15:21:08' ows_Author='462;#Workman, Steve' ows_Editor='462;#Workman, Steve' ows_owshiddenversion='1' ows_WorkflowVersion='1' ows__UIVersion='512' ows__UIVersionString='1.0' ows_Attachments='0' ows__ModerationStatus='0' ows_LinkTitleNoMenu='Five' ows_LinkTitle='Five' ows_SelectTitle='5' ows_Order='500.000000000000' ows_GUID='{406018AE-EF0F-4789-B3F2-FDC09C0D17D3}' ows_FileRef='5;#pdm/Lists/Segments/5_.000' ows_FileDirRef='5;#pdm/Lists/Segments' ows_Last_x0020_Modified='5;#2010-12-07 06:10:09' ows_Created_x0020_Date='5;#2010-12-07 06:10:09' ows_FSObjType='5;#0' ows_PermMask='0x7fffffffffffffff' ows_FileLeafRef='5;#5_.000' ows_UniqueId='5;#{13573117-A528-46E0-BE9B-A066CC14A8DE}' ows_ProgId='5;#' ows_ScopeId='5;#{0A8885B3-92F5-4F6B-A7E1-58FB7543BEB6}' ows__EditMenuTableStart='5_.000' ows__EditMenuTableEnd='5' ows_LinkFilenameNoMenu='5_.000' ows_LinkFilename='5_.000' ows_ServerUrl='/pdm/Lists/Segments/5_.000' ows_EncodedAbsUrl='http://example.com/pdm/Lists/Segments/5_.000' ows_BaseName='5_' ows_MetaInfo='5;#' ows__Level='1' ows__IsCurrentVersion='1' />
   <z:row ows_ContentTypeId='0x0100DDB33E0A25E44140B53A905E8CD2C111' ows_Title='Six' ows_DisplayName='Six' ows_ID='6' ows_ContentType='Item' ows_Modified='2010-06-14 15:21:21' ows_Created='2010-06-14 15:21:21' ows_Author='462;#Workman, Steve' ows_Editor='462;#Workman, Steve' ows_owshiddenversion='1' ows_WorkflowVersion='1' ows__UIVersion='512' ows__UIVersionString='1.0' ows_Attachments='0' ows__ModerationStatus='0' ows_LinkTitleNoMenu='Six' ows_LinkTitle='Six' ows_SelectTitle='6' ows_Order='600.000000000000' ows_GUID='{7C22C33A-8ECC-41B8-9D3E-DAA3DF02DE19}' ows_FileRef='6;#pdm/Lists/Segments/6_.000' ows_FileDirRef='6;#pdm/Lists/Segments' ows_Last_x0020_Modified='6;#2010-12-07 06:10:12' ows_Created_x0020_Date='6;#2010-12-07 06:10:12' ows_FSObjType='6;#0' ows_PermMask='0x7fffffffffffffff' ows_FileLeafRef='6;#6_.000' ows_UniqueId='6;#{35C0E27B-8F11-47E2-84B9-3074864AA91E}' ows_ProgId='6;#' ows_ScopeId='6;#{0A8885B3-92F5-4F6B-A7E1-58FB7543BEB6}' ows__EditMenuTableStart='6_.000' ows__EditMenuTableEnd='6' ows_LinkFilenameNoMenu='6_.000' ows_LinkFilename='6_.000' ows_ServerUrl='/pdm/Lists/Segments/6_.000' ows_EncodedAbsUrl='http://example.com/pdm/Lists/Segments/6_.000' ows_BaseName='6_' ows_MetaInfo='6;#' ows__Level='1' ows__IsCurrentVersion='1' />
   <z:row ows_ContentTypeId='0x0100DDB33E0A25E44140B53A905E8CD2C111' ows_Title='Seven' ows_DisplayName='Seven' ows_ID='7' ows_ContentType='Item' ows_Modified='2010-06-25 13:48:18' ows_Created='2010-06-25 13:48:18' ows_Author='462;#Workman, Steve' ows_Editor='462;#Workman, Steve' ows_owshiddenversion='1' ows_WorkflowVersion='1' ows__UIVersion='512' ows__UIVersionString='1.0' ows_Attachments='0' ows__ModerationStatus='0' ows_LinkTitleNoMenu='Seven' ows_LinkTitle='Seven' ows_SelectTitle='7' ows_Order='700.000000000000' ows_GUID='{015566E8-B432-460E-911F-3325BF9EC6ED}' ows_FileRef='7;#pdm/Lists/Segments/7_.000' ows_FileDirRef='7;#pdm/Lists/Segments' ows_Last_x0020_Modified='7;#2010-12-07 06:10:22' ows_Created_x0020_Date='7;#2010-12-07 06:10:22' ows_FSObjType='7;#0' ows_PermMask='0x7fffffffffffffff' ows_FileLeafRef='7;#7_.000' ows_UniqueId='7;#{2FFD2B33-92EF-4181-9A7C-5E6D96D90E26}' ows_ProgId='7;#' ows_ScopeId='7;#{0A8885B3-92F5-4F6B-A7E1-58FB7543BEB6}' ows__EditMenuTableStart='7_.000' ows__EditMenuTableEnd='7' ows_LinkFilenameNoMenu='7_.000' ows_LinkFilename='7_.000' ows_ServerUrl='/pdm/Lists/Segments/7_.000' ows_EncodedAbsUrl='http://example.com/pdm/Lists/Segments/7_.000' ows_BaseName='7_' ows_MetaInfo='7;#' ows__Level='1' ows__IsCurrentVersion='1' />
   <z:row ows_ContentTypeId='0x0100DDB33E0A25E44140B53A905E8CD2C111' ows_Title='Eight' ows_DisplayName='Eight' ows_ID='8' ows_ContentType='Item' ows_Modified='2010-06-28 16:54:40' ows_Created='2010-06-28 16:54:40' ows_Author='462;#Workman, Steve' ows_Editor='462;#Workman, Steve' ows_owshiddenversion='1' ows_WorkflowVersion='1' ows__UIVersion='512' ows__UIVersionString='1.0' ows_Attachments='0' ows__ModerationStatus='0' ows_LinkTitleNoMenu='Eight' ows_LinkTitle='Eight' ows_SelectTitle='8' ows_Order='800.000000000000' ows_GUID='{FEEBEFAC-3FC6-4F92-A03E-5202F3FB7295}' ows_FileRef='8;#pdm/Lists/Segments/8_.000' ows_FileDirRef='8;#pdm/Lists/Segments' ows_Last_x0020_Modified='8;#2010-12-07 06:10:22' ows_Created_x0020_Date='8;#2010-12-07 06:10:22' ows_FSObjType='8;#0' ows_PermMask='0x7fffffffffffffff' ows_FileLeafRef='8;#8_.000' ows_UniqueId='8;#{2D5EB204-7915-46E8-AC46-569B607F732D}' ows_ProgId='8;#' ows_ScopeId='8;#{0A8885B3-92F5-4F6B-A7E1-58FB7543BEB6}' ows__EditMenuTableStart='8_.000' ows__EditMenuTableEnd='8' ows_LinkFilenameNoMenu='8_.000' ows_LinkFilename='8_.000' ows_ServerUrl='/pdm/Lists/Segments/8_.000' ows_EncodedAbsUrl='http://example.com/pdm/Lists/Segments/8_.000' ows_BaseName='8_' ows_MetaInfo='8;#' ows__Level='1' ows__IsCurrentVersion='1' />
</rs:data>
</listitems></GetListItemsResult></GetListItemsResponse></soap:Body></soap:Envelope>

Change History

comment:1 follow-up: ↓ 2 Changed 3 years ago by addyosmani

  • Owner set to steve.workman@…
  • Priority changed from undecided to low
  • Status changed from new to pending
  • Component changed from unfiled to selector

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate:  http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

comment:2 in reply to: ↑ 1 Changed 3 years ago by steveworkman

Replying to addyosmani:

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate:  http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

Thanks Addy. The test case can be found here:  http://download.steveworkman.com/jQueryXMLTest.zip - As discussed on Twitter, I can't use jsFiddle as XML requires POST and the SharePoint server I'm using is not publically available.

comment:3 follow-up: ↓ 4 Changed 3 years ago by dmethvin

.find("[nodeName='z:row']")

Examining the markup, I do not see a nodeName attribute anywhere. So it is correct that nothing was matched. It seems like you expected the selector to match the nodeName *property*, which it erroneously did in older versions.

I'm not sure that .find("z:row") or .find("row")will work because of the namespace, but that would be the correct way to do it since that's the name of the element. Not sure how cross-browser compatible that is, can you try it and let us know?

We have tried to tackle XML namespaces before but found hopeless consistency in browsers; see #4208 and  http://docs.jquery.com/Won%27t_Fix#SVG.2FXML.2FVML_Bugs

comment:4 in reply to: ↑ 3 Changed 3 years ago by steveworkman

Replying to dmethvin:

.find("[nodeName='z:row']")

Examining the markup, I do not see a nodeName attribute anywhere. So it is correct that nothing was matched. It seems like you expected the selector to match the nodeName *property*, which it erroneously did in older versions.

I'm not sure that .find("z:row") or .find("row")will work because of the namespace, but that would be the correct way to do it since that's the name of the element. Not sure how cross-browser compatible that is, can you try it and let us know?

We have tried to tackle XML namespaces before but found hopeless consistency in browsers; see #4208 and  http://docs.jquery.com/Won%27t_Fix#SVG.2FXML.2FVML_Bugs

Results below:

.find("z:row") doesn't work with any browser with 1.7
.find("row") works in Chrome 14 and Safari 5.1 (WinXP), but not in Firefox 7 or IE 8
.find("z\\:row") works in Firefox 7 and IE8, but not in Chrome 14 or Safari 5.1 (WinXP)
Therefore: .find("z\\:row, row") works in Chrome 14, Safari 5.1 (WinXP), IE8 and Firefox 7

Assuming the erroneous functionality doesn't come back, can there be an official way to access nodeName properties? Considering that "row" could come up anywhere in the XML it's more likely to bring back undesirable results than real ones.

This is likely to affect anyone who works with jQuery and SOAP web services

Last edited 3 years ago by steveworkman (previous) (diff)

comment:5 follow-up: ↓ 6 Changed 3 years ago by trac-o-bot

  • Status changed from pending to closed
  • Resolution set to invalid

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:6 in reply to: ↑ 5 Changed 3 years ago by steveworkman

Replying to trac-o-bot:

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Silly Trac-bot, I did reply! See comment 4.

Still, I'll repeat it here: Results below:

.find("z:row") doesn't work with any browser with 1.7
.find("row") works in Chrome 14 and Safari 5.1 (WinXP), but not in Firefox 7 or IE 8
.find("z\\:row") works in Firefox 7 and IE8, but not in Chrome 14 or Safari 5.1 (WinXP)
Therefore: .find("z\\:row, row") works in Chrome 14, Safari 5.1 (WinXP), IE8 and Firefox 7

Assuming the erroneous functionality doesn't come back, can there be an official way to access nodeName properties? Considering that "row" could come up anywhere in the XML it's more likely to bring back undesirable results than real ones.

This is likely to affect anyone who works with jQuery and SOAP web services

comment:7 Changed 3 years ago by addyosmani

  • Status changed from closed to reopened
  • Resolution invalid deleted

comment:8 Changed 3 years ago by dmethvin

  • Status changed from reopened to closed
  • Resolution set to worksforme

To check a property you could use a filter function; wrap in a one-line plugin if you prefer:

jQuery.fn.filterNode = function(name){
   return this.filter(function(){
      return this.nodeName === name;
   });
});

The .find("z\\:row, row") seems like a simpler solution though.

comment:9 Changed 3 years ago by dmethvin

#10665 is a duplicate of this ticket.

comment:10 Changed 3 years ago by dmethvin

#10787 is a duplicate of this ticket.

comment:11 Changed 3 years ago by dmethvin

#10822 is a duplicate of this ticket.

comment:12 Changed 3 years ago by dmethvin

  • Status changed from closed to reopened
  • Resolution worksforme deleted

comment:13 Changed 3 years ago by dmethvin

  • Status changed from reopened to closed
  • Resolution set to wontfix

Although there is a workaround in this ticket, I think it's more appropriate to close it wontfix due to the primary issue with namespaces in XML.

comment:14 Changed 3 years ago by navstev0

What!??! You mean you wont fix it, it will fix, I could fix it! Add a selector for checking namespaces, xhtml is huge and by not allowing namespace checks in jquery you are severely limiting the functionality, as more and more namespace uses will be found. I was not a part of the original ticket, but it broke my code as well. Priority low works for me, but don't cut it out of jquery, namespace are a part of xml!

comment:15 follow-up: ↓ 16 Changed 3 years ago by navstev0

Also .find("z
:row, row") is not a sufficient solution as it does not work with webkit. And your other provided solution which you can a work around doesn't allow attribute searching in the same context. So technically your work around don't work 100% around the problem.

comment:16 in reply to: ↑ 15 Changed 3 years ago by steveworkman

Replying to navstev0:

Also .find("z
:row, row") is not a sufficient solution as it does not work with webkit. And your other provided solution which you can a work around doesn't allow attribute searching in the same context. So technically your work around don't work 100% around the problem.

I looked into these issues more and raised a performance bug related to this #10720 and found that the plugin worked very well. I even managed to go further than that and in my  blog post I show a 2000% performance increase over the 1.6 compatible [nodename='z:row'] selector.

Please take a look at these articles.

comment:17 Changed 3 years ago by dmethvin

#11157 is a duplicate of this ticket.

comment:18 Changed 2 years ago by anonymous

I couldn't seem to get the 'filterNode' plugin to work.

But this seems to work for me..

.find("z
:row, row")

Note: See TracTickets for help on using tickets.