Problem extracting elements from XML datasource
Hi, I am trying to create a report in Report Builder that uses SharePoint's Search WebService as a data source. The query works ok and returns the data I'm after, but I can't figure out how to extract the data from the returned XML so I can use them as fields in the report. I'm reasonably sure it has something to do with the 'ElementPath' parameter in the query, but I'm not sure how to specify the fields I'm after (despite much reading and trial/error). Here is my query: <Query> <Method Name="QueryEx" Namespace="http://microsoft.com/webservices/OfficeServer/QueryService"> <Parameters> <Parameter Name="queryXml"> <DefaultValue><?xml version="1.0" encoding="utf-8" ?><QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1000"><Query domain="QDomain"> <SupportedFormats><Format>urn:Microsoft.Search.Response.Document.Document</Format></SupportedFormats> <Context> <QueryText language="en-US" type="STRING" > SCOPE:"Projects"</QueryText> </Context><Properties><Property name="ProjectCode" /><Property name="ProjectHealth" /><Property name="Title" /><Property name="Path" /><Property name="Write" /></Properties><SortByProperties><SortByProperty name="Rank" direction="Descending" order="1"/></SortByProperties> <Range><StartAt>1</StartAt><Count>200</Count></Range> <EnableStemming>false</EnableStemming> <TrimDuplicates>true</TrimDuplicates> <IgnoreAllNoiseQuery>false</IgnoreAllNoiseQuery> <ImplicitAndBehavior>false</ImplicitAndBehavior> <IncludeRelevanceResults>false</IncludeRelevanceResults> <IncludeSpecialTermResults>false</IncludeSpecialTermResults> <IncludeHighConfidenceResults>false</IncludeHighConfidenceResults></Query></QueryPacket></DefaultValue> </Parameter> </Parameters> </Method> <ElementPath IgnoreNamespaces="True">*</ElementPath> </Query> Which returns the following response: <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> <QueryExResponse xmlns="http://microsoft.com/webservices/OfficeServer/QueryService"> <QueryExResult> <xs:schema id="Results" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop"> <xs:element name="Results" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:QueryTerms="" msprop:IgnoredNoiseWords="" msprop:Keyword="" msprop:QueryModification="" msprop:ElapsedTime="119" msprop:Definition="" msprop:SpellingSuggestion=""> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="RelevantResults" msprop:TotalRows="10" msprop:IsTotalRowsExact="True"> <xs:complexType> <xs:sequence> <xs:element name="ProjectCode" type="xs:string" minOccurs="0"/> <xs:element name="ProjectHealth" type="xs:string" minOccurs="0"/> <xs:element name="Title" type="xs:string" minOccurs="0"/> <xs:element name="Path" type="xs:string" minOccurs="0"/> <xs:element name="Write" type="xs:dateTime" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema> <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"> <Results xmlns=""> <RelevantResults diffgr:id="RelevantResults1" msdata:rowOrder="0"> <ProjectCode>qwerty</ProjectCode> <ProjectHealth>Green</ProjectHealth> <Title>test3</Title> <Path>http://temp/Lists/PI Projects/DispForm.aspx?ID=6</Path> <Write>2011-05-13T07:45:51+09:30</Write> </RelevantResults> <RelevantResults diffgr:id="RelevantResults2" msdata:rowOrder="1"> <ProjectCode>abcdefg</ProjectCode> <ProjectHealth>Green</ProjectHealth> <Title>test4</Title> <Path>http://temp/Lists/PI Projects/DispForm.aspx?ID=7</Path> <Write>2011-05-13T07:46:00+09:30</Write> </RelevantResults> <RelevantResults diffgr:id="RelevantResults3" msdata:rowOrder="2"> <ProjectCode>5555</ProjectCode> <ProjectHealth>Green</ProjectHealth> <Title>test 5</Title> <Path>http://temp/Lists/PI Projects/DispForm.aspx?ID=8</Path> <Write>2011-05-13T09:52:06+09:30</Write> </RelevantResults> <RelevantResults diffgr:id="RelevantResults4" msdata:rowOrder="3"> <ProjectCode>5555</ProjectCode> <ProjectHealth>Green</ProjectHealth> <Title>test 6</Title> <Path>http://temp/Lists/PI Projects/DispForm.aspx?ID=9</Path> <Write>2011-05-13T09:52:22+09:30</Write> </RelevantResults> <RelevantResults diffgr:id="RelevantResults5" msdata:rowOrder="4"> <ProjectCode>5555</ProjectCode> <ProjectHealth>Green</ProjectHealth> <Title>test 7</Title> <Path>http://temp/Lists/PI Projects/DispForm.aspx?ID=10</Path> <Write>2011-05-13T09:52:30+09:30</Write> </RelevantResults> <RelevantResults diffgr:id="RelevantResults6" msdata:rowOrder="5"> <ProjectCode>5555</ProjectCode> <ProjectHealth>Green</ProjectHealth> <Title>test 8</Title> <Path>http://temp/Lists/PI Projects/DispForm.aspx?ID=11</Path> <Write>2011-05-13T09:52:38+09:30</Write> </RelevantResults> <RelevantResults diffgr:id="RelevantResults7" msdata:rowOrder="6"> <ProjectCode>5555</ProjectCode> <ProjectHealth>Green</ProjectHealth> <Title>test 9</Title> <Path>http://temp/Lists/PI Projects/DispForm.aspx?ID=12</Path> <Write>2011-05-13T09:52:46+09:30</Write> </RelevantResults> <RelevantResults diffgr:id="RelevantResults8" msdata:rowOrder="7"> <ProjectCode>5555</ProjectCode> <ProjectHealth>Green</ProjectHealth> <Title>test 10</Title> <Path>http://temp/Lists/PI Projects/DispForm.aspx?ID=13</Path> <Write>2011-05-13T09:52:54+09:30</Write> </RelevantResults> <RelevantResults diffgr:id="RelevantResults9" msdata:rowOrder="8"> <ProjectCode>1234</ProjectCode> <ProjectHealth>Yellow</ProjectHealth> <Title>test</Title> <Path>http://temp/Lists/PI Projects/DispForm.aspx?ID=4</Path> <Write>2011-05-13T04:15:54+09:30</Write> </RelevantResults> <RelevantResults diffgr:id="RelevantResults10" msdata:rowOrder="9"> <ProjectCode>Pro123</ProjectCode> <ProjectHealth>Green</ProjectHealth> <Title>test 2</Title> <Path>http://temp/Lists/PI Projects/DispForm.aspx?ID=5</Path> <Write>2011-05-13T07:45:37+09:30</Write> </RelevantResults> </Results> </diffgr:diffgram> </QueryExResult> </QueryExResponse> </soap:Body> </soap:Envelope> The fields I'm trying to extract are Title, ProjectCode, ProjectHealth and Path. Any help is greatly appreciated.
May 17th, 2011 3:28am

Hi, You can try to retrieve the dataset from the sharepoint list. For more information about SQL Reporting Services data from SharePoint lists, please see: http://www.codeproject.com/KB/reporting-services/ReportFromSharePoint.aspx Thanks, Challen FuPlease remember to mark the replies as answers if they help and unmark them if they provide no help.
Free Windows Admin Tool Kit Click here and download it now
June 6th, 2011 10:43pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics