# Saturday, 23 April 2016


Some time you may need to wrap text node in a CDATA section as part of your XQuery development. For example say you need to generate the following document


<?xml version="1.0" encoding="UTF-8"?>
<sf:Resource xmlns:sf="http://www.canadapost.ca/smartflow" contentID="PAYMENT">
<![CDATA[
        <payment-data>
           <account-number>bar</account-number>
            <total-due>bar</total-due>             <due-date>bar</due-date>         </payment-data> ]]></sf:Resource>

The following query makes use of a processor specific XQuery option called ddtek:serialize 

Notice the syntax to define an expanded QName with namespace is { {uri} local-name }  which is different from what is erroneously described in the XQuery Tips & Tricks 

The second takeaway is how the content inside sf:Resource needs to be escaped text to produce the required result

declare namespace sf="http://www.canadapost.ca/smartflow";
declare option ddtek:serialize "omit-xml-declaration=no,encoding=UTF-8,indent=yes,cdata-section-elements={{http://www.canadapost.ca/smartflow}Resource}";
declare variable $foo := "bar";
<sf:Resource contentID="PAYMENT">
   &lt;payment-data&gt;
       &lt;account-number&gt;{ $foo }&lt;/account-number&gt;
       &lt;total-due&gt;{ $foo }&lt;/total-due&gt;
       &lt;due-date&gt;{ $foo }&lt;/due-date&gt;
   &lt;/payment-data&gt;
</sf:Resource>


Multiple CDATA sections are declared using ; as separator


cdata-section-elements="{{http://www.canadapost.ca/smartflow}Resource};{{http://www.canadapost.ca/smartflow}Foo}"




posted on Saturday, 23 April 2016 17:58:32 (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Wednesday, 26 August 2015
Acrobat Reader Error
posted on Wednesday, 26 August 2015 15:41:54 (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Monday, 17 August 2015
Save 25% on Stylus Studio


Hey there,

Ryan Andrews from the Stylus Studio team here. I wanted to send you a quick email and let you know about a "Super Summer Sale" we are currently running for users who recently downloaded a free trial of Stylus Studio - the advanced XML Integrated Development Environment (XML IDE).

This offer gets you 25% Off on Stylus Studio Licenses and AUP. All you have to do is click one of the links below to buy, or use the code - Summer25 - on the online store at www.stylusstudio.com. This offer expires August 28th.


Stylus Studio X15 Release 2 Enterprise Suite
Save 25% Now »

Stylus Studio X15 Release 2 Professional Suite
Save 25% Now »

Please email me if you have any questions or would like to take advantage of this special, limited-time offer.

Sincerely,

Ryan Andrews
Stylus Studio Team
ryan.andrews@ivitechnologies.com


Offer valid on new, full, standard priced licenses of Stylus Studio X15 Release 2 Professional and Enterprise Edition. Discount on AUP only valid when purchased with new licenses of Stylus Studio on the Stylus Studio online store. This offer cannot be combined with any other offer. Offer only valid on Stylus Studio online store.

posted on Monday, 17 August 2015 09:37:52 (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback