Working with XML in Nintex WF (simplified)

Document created by Dan Stoll Employee on Mar 2, 2015Last modified by Frank Field on Oct 26, 2016
Version 2Show Document
  • View in full screen mode

Checking out the interwebs the other day and came across this great blog post by my buddy John Liu (@johnnliu) | Twitter John and the group he works with have done some amazing SharePoint and Nintex work over the years.. Anyway..... He posted about something that I had come across a few times myself  over the past few years, so in the interest in sharing, I got John's permission to report the info here for everyone knowledge..

Problem:

You call an XML web service with Nintex Web Service or Web Request actions.  You get back a lot of XML, and it is very difficult to work with the namespaces getting in your way.

 

Solution:

 

1. Do a quick XSLT post processing in the action, remove all the namespaces with XSLT transform.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
    
<xsl:template match="*">        
    <xsl:element name="{local-name()}">            
    <xsl:apply-templates select="@* | node()" />        
    </xsl:element> 
</xsl:template>    
<xsl:template match="@*">        
    <xsl:attribute name="{local-name()}">            
    <xsl:value-of select="." />        
    </xsl:attribute>    
</xsl:template>    
<xsl:template match="text() | comment() | processing-instruction()"> 
    <xsl:copy />    
</xsl:template> 
</xsl:stylesheet>

 

2. Force top level XML node.

This ensures if your service returns multiple top level elements they get wrapped together.

 

3. Use XPath in Query XML Action like this:

/xml/Results/Result/Title

 

Sometimes, after you've wasted half a day working with XML, you just want the simple, no frills, just make it work version.

This will hopefully help you too.

 

Big thanks to Jumpei Yamauchi for helping me with this one.

 

This document was generated from the following discussion: Working with XML in Nintex Workflows (simplified)

2 people found this helpful

Attachments

    Outcomes