Developer forum

Forum » Integration » Export CDATA nodes in XML

Export CDATA nodes in XML

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a request t export an XML feed for Google merchant. One of the requests of this is that the elements need to be encapsulated in CDATA markup.

I have tested locally using the XML that's generated by Dynamicweb and an XSLT using <xsl:output method="xml" cdata-section-elements="title description"/> and the result is correctly generated with CDATA markup for the 2 fields indicated.

In the Data Integration however, the result does not have any CDATA markup.

I could not find a setting that I could turn on or off in order to get me the desired result.

I have seen that you are using CDATA markup in your exports, therefore it should work.

I have attached the xslt I am using against a regular Products export.

Thank you,

Adrian


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Adrian,
you can edit your xslt to make the desired xml format for your destination xml file and then choose it in the Xml provider destination settings:

Regards, Dmitrij
Votes for this answer: 1
 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Dmitriy,

Thank you for the feedback. I am afraid I was not clear on my question. 
I have already tried that and the output does not have CDATA markup although testing locally with the XML and XSLT (using XML notepad) the result has the CDATA markup.

That's what I am questioning about. Why does the DW output ignore the cdata elements defined in the xslt?

Thank you,
Adrian

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Adrian,
that is a bug, new tfs# 60923 created. Problem is that current XML provider does not handle the XSLT file "cdata-section-elements" option, so until it will be fixed you could try some manual
cdata wrapping shown in the first example here.
Regards, Dmitrij

Votes for this answer: 1
 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Dmitrij,

Thank you for the confirmation. I will proceed with the solution you indicated.

Thank you,
Adrian

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Dmitrij,

While you are at it, can you also check if it's possible to allow using C# code in XSLT?

I tried it and I've got this message: Execution of scripts was prohibited. Use the XsltSettings.EnableScript property to enable it.

And it seems this has to be set on the wrapper that applies the XSLT on the XML.

One example of the reason for this request is the generation of feeds. For generating a product feed, you can use Data integration and EcomProducts (instead of publishing the feed to a content page). But in all feeds, you have to supply the URL to the page. And ideally, you would have to supply the friendly URL to the page.

This means that, in theory, using C# you might actually be able to use Dynamicweb.Frontend.SearchFriendlyURL.GetFriendlyURl(string URL)

Thank you,

Adrian

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Adrian,
will be added in tfs# 60999.
Regards, Dmitrij

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Dmitrij,

Many thanks,

Adrian

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Adrian

The feature #60999 XmlProvider Enable C# code has been added to Dynamicweb version 9.6.2

To upgrade please choose this version from download:

http://doc.dynamicweb.com/releases-and-downloads/releases

Let me know if you need any more help regarding this

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 

You must be logged in to post in the forum