Thats certainly sounds a whole lot more flexible. I'll get chance to play
around with the beta one day ... happy grin ... one day
"Christoph Schittko [MVP]" <INVALIDEMAIL@austin.rr.com> wrote in message
news:%23wAaZeW1EHA.1308@TK2MSFTNGP09.phx.gbl...
> Pete,
>
> It might also be interesting to you that Visual Studio 2005 ships with
> an XmlDataSource object to bind XML data to web server controls [0].
> Note that Microsoft did not make the XmlDocument itself bindable but
> followed the general provider pattern in ASP.NET 2.0 to enable binding
> of XML data.
>
> HTH,
> Christoph Schittko
> MVP XML
>
http://weblogs.asp.net/cschittko >
> [0]
http://msdn2.microsoft.com/library/e8d8587a.aspx >
> > -----Original Message-----
> > From: pete [mailto:no_spam@hotmail.com]
> > Posted At: Saturday, November 27, 2004 7:16 PM
> > Posted To: microsoft.public.dotnet.xml
> > Conversation: XmlDocument and DataBinding
> > Subject: Re: XmlDocument and DataBinding
> >
> > Thanks for the explanation martin. I didn't expect to be able to use
> the
> > IEnumerable interface of the XmlDocument in any sensible way but was
> > curious
> > why I couldn't use it at all. In your example, I notice that you use
> > explicit casting in your databinding expression rather than
> > DataBinder.Eval(). Is there any reason for this?
> >
> > Cheers, Pete
> >
> > "Martin Honnen" <mahotrash@yahoo.de> wrote in message
> > news:ukiBpXJ1EHA.2600@TK2MSFTNGP09.phx.gbl...
> > >
> > >
> > > pete wrote:
> > >
> > > > It's my understanding that XmlDocument inherits its implementation
> of
> > > > IEnumerable interface from the XmlNode type. Here is the doc:
> > > >
> >
http://msdn.microsoft.com/library/default.asp?url=/library/en-
> > us/cpref/html/frlrfsystemxmlxmlnodeclasstopic.asp.
> > > > However, by looking at the documentation for the IEnumerable
> interface
> > its
> > > > clear that XmlDocument isn't one of the classes that supports it.
> > > >
> > > > I guess the question I'm asking is, if XmlNode is IEnumerable then
> why
> > isn't
> > > > XmlDocument?
> > >
> > > You are right, as XmlNode implements IEnumerable XmlDocument
> inherits
> > > that implementation. And thus XmlDocument can be bound as in the
> > > following example:
> > >
> > > <%@ Page Language="C#" %>
> > > <%@ Import Namespace="System.Xml" %>
> > > <html>
> > > <head>
> > > <title>binding an XmlDocument to a DataList</title>
> > > <script runat="server">
> > > void Page_Load () {
> > > XmlDocument xmlDocument = new XmlDocument();
> > > xmlDocument.PreserveWhitespace = true;
> > > xmlDocument.LoadXml(@"<?xml version=""1.0""?>
> > > <!-- Kibology for all -->
> > > <gods>
> > > <god>Kibo</god>
> > > <god>Xibo</god>
> > > </gods>");
> > > DataList1.DataSource = xmlDocument;
> > > DataList1.DataBind();
> > > }
> > > </script>
> > > </head>
> > > <body>
> > > <form runat="server">
> > > <asp:DataList id="DataList1" runat="server">
> > > <ItemTemplate>
> > > <%#((System.Xml.XmlNode)Container.DataItem).NodeType%>
> > > </ItemTemplate>
> > > </asp:DataList>
> > > </form>
> > > </body>
> > > </html>
> > >
> > > which then outputs
> > >
> > > XmlDeclaration
> > > Whitespace
> > > Comment
> > > Whitespace
> > > Element
> > >
> > > So what the enumerator for an XmlDocument does is enumerating the
> top
> > > level child nodes and you can bind those if you are interested in
> them.
> > > Only the data in an XML document is usually not contained directly
> in
> > > top level child nodes of the document itself but in child nodes and
> > > descendants of the document element and if you want to display that
> data
> > > you need to first access the child nodes or descendants so that is
> why
> > > you will probably end up using a node list returned by SelectNodes
> or
> > > GetElementsByTagName.
> > >
> > > --
> > >
> > > Martin Honnen
> > >
http://JavaScript.FAQTs.com/ >
>