Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3681258
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:40:12+00:00 2026-05-19T03:40:12+00:00

I am querying the Microsoft Office SharePoint Server Search Service to write some results

  • 0

I am querying the Microsoft Office SharePoint Server Search Service to write some results into a web part. I have the query working correctly but am having some trouble parsing the xml response via JQuery.

Below is the XML response :

<document>
<properties>
 <Property>
  <Name>p1</Name> 
  <Type>String</Type> 
  <Value>blue</Value> 
  </Property>
<Property>
  <Name>title</Name> 
  <Type>string</Type> 
  <Value>titreA</Value> 
  </Property>
  </properties>
</document>
<document>
<properties>
 <Property>
  <Name>p1</Name> 
  <Type>String</Type> 
  <Value>blue</Value> 
  </Property>
  <Property>
  <Name>title</Name> 
  <Type>string</Type> 
  <Value>titreB</Value> 
  </Property>
  </properties>
</document>
<document>
<properties>
 <Property>
  <Name>p1</Name> 
  <Type>String</Type> 
  <Value>green</Value> 
  </Property>
 <Property>
  <Name>title</Name> 
  <Type>string</Type> 
  <Value>titreC</Value> 
  </Property>
  </properties>
</document>
<document>
<properties>
 <Property>
  <Name>p1</Name> 
  <Type>String</Type> 
  <Value>red</Value> 
  </Property>
 <Property>
  <Name>title</Name> 
  <Type>string</Type> 
  <Value>titreD</Value> 
  </Property>
  </properties>
</document>

How can i retrieve p1 value, and number of occurence of this value ?
Like this : blue(2), green(1), red(1)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T03:40:13+00:00Added an answer on May 19, 2026 at 3:40 am

    XML data can be ‘parsed’ using jQuery’s methods just like HTML. Assuming data is the XML data.

    var name = 'p1';
    $data = $(data);
    $p1 = $data.find('Name:contains("'+name+'")').parent('Property');
    p1Value = $p1.map(function(i,v){
      return $(v).children('Value').text(); 
    }).get();
    alert(p1Value);
    

    p1Value is an array of values that have a name of ‘p1’.

    p1Value[0] is equal to ‘blue’.

    If you also want the number of occurrences, you can do this.

    var name = 'p1';
    $data = $(data);
    $p1 = $data.find('Name:contains("'+name+'")').parent('Property');
    p1Values = {};
    $p1.each(function(i,v){
      var val = $(v).children('Value').text();
      if(p1Values.hasOwnProperty(val)){
        p1Values[val]++;
      }
      else{
        p1Values[val] = 1;
      }
    });
    

    p1Values is an object with the value as the property name, and the occurrences as the property value.

    p1Value['blue'] is equal to 2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am querying the Microsoft Office SharePoint Server Search Service to write some results
I have a web site that uses Microsoft Indexing Service to index and query
The following web page describes querying Windows Search programmatically: http://msdn.microsoft.com/en-us/library/aa965362.aspx Does anyone have examples
I'm querying Sharepoint server-side and getting back results as Xml. I want to slim
I'm installing Microsoft Search Server 2008 express with a view to indexing some content
So I have learned that that the Microsoft.Jet.OLEDB.4.0 data provider for querying data sources
I'm trying to do quite a lot of querying against a Microsoft SQL Server
I have a PHP application which connects to Microsoft Exchange server to retrieve 'Contacts'
I am querying tables from Microsoft SQL 2008 which have date split across 3
In on-premises Microsoft SQL Server, when I issue this query: SELECT * FROM sys.dm_exec_sessions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.