Xpath to extract Data from XML returned by Nintex webservice

Posted on 2011-10-04
Last Modified: 2012-05-12
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="">

<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 !
Question by:pratz09
    LVL 59

    Accepted Solution

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

    Author Closing Comment

    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 !

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video discusses moving either the default database or any database to a new volume.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now