Creating an XML export of data

david jones asked on June 9, 2016 09:32

Kentico Version: 8

Hey Guys, i'm pretty new to the kentico world.. so i'm really struggling to get my head around how to output XML in kentico.. MVC it would be a 5min job but it's taken me hours and i'm still not making progress.

so some of the options i've looked at are creating a new template without a master page and then just adding XML to that.. didn't work.

i've tried making a custom webpart and i can output all the fields i need but then i can't output the data as XML without html being spat all over the page.

i'm at the stage we've i've created a new page, blank template and added the XML web part, i then add XML repeater but not really sure how to reference my data. When using the CMS Rss Feed, i can just select which doc type i want and then i can point directly at tree level as a source of data .. but the xml repeater is different (why?) and requires me to know data tables etc.

is there a tutorial out there that can help me? or anyone just give me a simple way to do this? can i create a web part that has no fields but i can just create the datasource within that webpart?

webforms.. ahh hurts my head.

Correct Answer

Dawid Jachnik answered on June 9, 2016 15:23

Hello,

it's 5 min in the webforms too ;)

You can use Pages Data Source web part to retrive data from pages or other kind of data sources. Then to display data you can use XML repeater, there you can define the Data source name (it should be Web part control ID from Pages Data Source), transformation (for exmaple Text/XML type), you can define there also Feed header and footer.

3 votesVote for this answer Unmark Correct answer

Recent Answers


david jones answered on June 10, 2016 07:44

that is brilliantly simple! thanks! exactly what i need. one more question, how do i go about getting the full image URL?

i'm using

<Image><%# GetFileUrl("ImageGuid") %></Image>

which returns: /getattachment/45b23d1b-211e-4721-86e5-66723d857163/my-image-title

how do i return the full URL? thanks!

0 votesVote for this answer Mark as a Correct answer

Jan Hermann answered on June 10, 2016 07:58

You can call GetAbsoluteUrl over it:

<%# GetAbsoluteUrl(GetFileUrl("ImageGuid")) %>

0 votesVote for this answer Mark as a Correct answer

david jones answered on June 10, 2016 08:07

thanks guys - you've been super helpful!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.