简体   繁体   中英

Filtering through XML results

I need to go through some data and pick out certain items which match my criteria. I'm using Client-side scripting to return XML which looks like this:

<List DocTemplateUrl=
      "" DefaultViewUrl="/TestWeb1/Lists/Announcements/AllItems.aspx" 
      ID="{8A98E2E5-B377-4D0E-931B-3AC25BD09926}" Title="Announcements" 
      Description="Use the Announcements list to post messages on the 
         home page of your site." 
      ImageUrl="/_layouts/images/itann.gif" 
         Name="{8A98E2E5-B377-4D0E-931B-3AC25BD09926}" 
      BaseType="0" ServerTemplate="104" 
         Created="20030613 18:47:12" Modified="20030613 18:47:12" 
      LastDeleted="20030613 18:47:12" Version="0" Direction="none" 
         ThumbnailSize="" WebImageWidth="" 
      WebImageHeight="" Flags="4096" ItemCount="1" 
         AnonymousPermMask="" RootFolder="" ReadSecurity="1" 
      WriteSecurity="1" Author="1" 
         EventSinkAssembly="" EventSinkClass="" 
         EventSinkData="" EmailInsertsFolder="" 
      AllowDeletion="True" AllowMultiResponses="False" 
         EnableAttachments="True" EnableModeration="False" 
      EnableVersioning="False" Hidden="False" MultipleDataList="False" 
         Ordered="False" ShowUser="True" />

In this result there are certain list nodes which contain the property serverTemplate="101". I'm trying to find the specific lists which have this template using jQuery find.

I have something like this: $(xData.responseXML).find("List").each(function() to get all the lists but how can I refine this to get all the lists which have the property serverTemplate="101"?

使用属性等于选择器

$(xData.responseXML).find('List[serverTemplate="101"]')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM