Getting rid of Nilled elements in a message from a database poller in the OSB
Submitted by Hugo Hendriks on Fri, 22/07/2011 - 16:21
When you create a database poller in the OSB you will encounter that empty values in the database will appear in your request as xsi:nil="true".
When calling another service with values like
<sch:voorvoegsel xsi:nil="true"/>
you will run into validation problems so you want to remove those elements. You can use XQuery to filter them out but when I tried to use the fn:nilled function, it didn't do what I expected it to do. When I looked around I found this blog: http://www.oradevblog.nl/?p=229 which explains why it doesn't work. Solution......you can define a is_nilled function of your own which does the trick. It looks like this:
declare function xf:is_nilled ( $element as element() ) as xs:boolean { if (fn:exists($element/@xsi:nil)) then fn:exists($element[@xsi:nil=fn:true()]) else fn:false() };

