[Mono-list] Binding XML Data to DataList

Marc DM m at phronein.com
Sat Jun 18 13:30:17 EDT 2005

I'm trying to find a nice way to display XML Data in an ASP.NET page
similar to DataBinding web controls like the DataGrid and DataList.

I know I could use DataSet.ReadXml method to import my Xml into a
dataset and then Bind that to the DataGrid but I don't want to convert
the hierarchical data coming from the Xml files into relational data
that will defeat the purpose of using xml. It would also result in me
having to write (and debug) more code. 

I encountered Alex Feinman's blog on the same subject

I downloaded the package and am now trying it out. However, I'm getting
an error which indicates that the XmlDataBinder object is exposing an
XmlElement to the DataList as opposed to exposing the string found at
the XPath string specified.

The error I get is :

  >> Property @href not found in System.Xml.XmlElement

on mono/xsp

  >> DataBinder.Eval: 'System.Xml.XmlElement' does not contain a
property with the name @href

on Win2k/.NET 1.1.4322.2032

the ItemTemplate that  throws the error looks like 

<asp:HyperLink runat="server" 
#DataBinder.Eval(((DataListItem)Container).DataItem,"@href") %> >
<asp:Image runat="server" width="200"
"@caption") + ".jpg"%> />
<br />

and when creating the XmlDataSource object, the following parameters are
used :

dlg.DataSource = new XmlDataSource(xdoc1.DocumentElement.ChildNodes,

Has anyone else tried this or something similar? 

Help ! :(

Marc DM

Kingston, JM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://galactus.ximian.com/pipermail/mono-list/attachments/20050618/d1e2baba/attachment.html

More information about the Mono-list mailing list