Avatar of pratz09
Flag for United States of America

asked on 

Xpath to extract Data from XML returned by Nintex webservice

I am developing a Nintex workflow which iterates through all the list items in a List View and terminate all the running workflows. The List views on which this workflow is going to run already have filters on it.

To get collection of all the list items in the List View, I am planning to call GetListItems method in Lists.asmx
      GetListItems take ListName and ViewName as parameters. But ViewName is actually 32 digit GUID. In my research I found GetViewCollection method returns all the views defined in a list.
My plan is to get collection of all the views in the list. (Both List Name and View Name (Display name of the view) is provided by the user).
Then I will compare Display Name of all the views in the collection with the name provided by user. When I find match I will take that GUID and plug it into Lists.GetListItems() to get collection of all the list items in that List view.

Eventually I will call TerminateWorkflowByNameForListItem() to terminate the workflow running on that itemID.

But I am stuck at the step where I am calling GetViewCollection method. It returns in XML which looks like this:

<Views xmlns="http://schemas.microsoft.com/sharepoint/soap/">

<View Name="{705D9879-6A17-4FF3-8D4A-AF1CC5E86605}" Type="HTML" DisplayName="All Items" Url="/sandbox/Lists/custom list test/AllItems.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/generic.png" />

<View Name="{0D9FC0C9-AE20-482D-AB1E-2A189AB8A0D1}" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" Type="HTML" DisplayName="test_view" Url="/sandbox/Lists/custom list test/test_view.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/generic.png" />

<View Name="{D860A584-4EC0-473D-82FF-F717769C5D20}" Type="HTML" DisplayName="list id" Url="/sandbox/Lists/custom list test/list id.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/generic.png" />

<View Name="{19A48EAF-E644-49CB-B597-87B3A8584E10}" Type="HTML" DisplayName="Test view" Url="/sandbox/Lists/custom list test/Test view.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/generic.png" />


Ideally I should be able to get collection of all ViewName (GUIDs) by using "Query XML" with Xpath expression like "//Views/View/Name" but it doesn't work.

I figured, the XML returned by GetViewCollection method is not a well formatted XML. "Query XML" likes the input to be something like:

            <Name> <\Name>

What should I do ? What could be Xpath expression to extract Name and DisplayName data from the above XML. Please help !
Microsoft SharePointXML

Avatar of undefined
Last Comment

8/22/2022 - Mon