API
Version 7.x > API > XMLDatasource and Basic Repeater. View modes: 
User avatar
Member
Member
vinie.09-gmail - 5/31/2013 10:51:31 AM
   
XMLDatasource and Basic Repeater.
Hi
I have the following XML which i have set up in my project directory and plugged it into XMLDatasource.

<?xml version="1.0" encoding="utf-8" ?>
<IRXML CorpMasterID="xxxx">
<NewsReleases PubDate="20130926" PubTime="14:31:11">
<NewsCategory Category="FinancialReleases">
<NewsRelease ReleaseID="325998" DLU="20130528 15:43:00" ArchiveStatus="Current">
<Title>xxxx Further Solidifies Leading Position in Growing Mobility Market Printer Friendly Version</Title>
<Date date="20130528" Time="15:32:00">5/28/2013 3:32:00 PM</Date>
<Categories>
<Category>Financial Releases</Category>
</Categories>
</NewsRelease>
<NewsRelease ReleaseID="325999" DLU="20130528 15:43:00" ArchiveStatus="Current">
<Title>xxxx Gives Back to Local Community at 20th Annual West Coast Charity Golf Tournament Printer Friendly Version</Title>
<Date date="20130528" Time="15:32:00">5/28/2013 3:32:00 PM</Date>
<Categories>
<Category>Financial Releases</Category>
</Categories>
</NewsRelease>
</NewsCategory>

</NewsReleases>

</IRXML>

I need to display NewsRelease->Title and NewsRelease->Date node values. I setup the table name as NewsRelease in XMLDatasource.
I then used a Basic repeater with following ascx transformation.

<<%# Eval("Date") %>

<%#Eval("Title")%>

The Title information is picked up and displayed correctly but Date is not. If i change the structure of the XML and removed the 'date' and 'Time' attributes associated with the Date node, even the Date value is picked up correctly.
Are the Date node attributes causing it to be read as a separate table. Changing the xml structure is not a viable option for me.
Could you please let me know if I am missing something here?
I am new to Kentico CMS.

User avatar
Kentico Support
Kentico Support
kentico_filipl - 6/3/2013 3:02:55 AM
   
RE:XMLDatasource and Basic Repeater.
Hi,

I am afraid you will have to parse and edit the xml structure if you want the data to be read as a single table because otherwise XML data source web part cannot process it correctly.

But I believe it should not be that difficult to do, you can take a look at the sample code examples - Remove Attribute Nodes by Object.

Best regards,
Filip Ligac