Working with XML in Nintex Workflows (simplified)

 

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.