ASP.NET 3.5 bind to XML string

With ASP.NET 3.5 I can easily bind to an XML file by using an XmlDataSource.

How can I bind to an XML string instead of a file?


Use the XmlDataSource.Data property.

XmlDataSource dataSource    = new XmlDataSource();
dataSource.Data             = "<root><element>Item #1</element><element>Item #2</element></root>";
dataSource.XPath            = "root/element";

Alternately, you could specify the data declaratively:

        <Book Title="Pure JavaScript" Author="Wyke, Gilliam, and Ting"/>
        <Book Title="Effective C++ Second Edition" Author="Scott Meyers"/>
        <Book Title="Assembly Language Step-By-Step" Author="Jeff Duntemann"/>
        <Book Title="Oracle PL/SQL" Author="Steven Feuerstein"/>

        <Book Title="Counter Hack" Author="Ed Skoudis"/>


Need Your Help

Algorithm to solve Local Alignment

string algorithm dynamic-programming string-matching traceback

Local alignment between X and Y, with at least one column aligning a C

Compiling GWT 2.7.0 against Errai 3.1.1.Final

java gwt errai

I'm trying to figure out if GWT 2.7.0 would compile against Errai 3.1.1.Final

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.