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 !
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kevin CrossChief Technology OfficerCommented:
Hi. Name is an attribute, so you would want //Views/View/@Name. Similarly, //Views/View/@DisplayName. Hope that helps!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pratz09Author Commented:
That's right. I already had value for DisplayName, so to find Name for a specific DisplayName I did:

//Views/View[@DisplayName= "test_view"]/@Name

Thanks a lot !
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.