Click here to Skip to main content
Click here to Skip to main content

XmlClient Managed Provider

, 16 Apr 2002
Rate this:
Please Sign up or sign in to vote.
A Class Library that holds a Managed Provider to retreive Load DataSets from Xml sources.
<!-- Download Links --> <!-- Add the rest of your HTML here -->


This is my first attempt at writing a Managed Provider. The idea behind it was to allow users of the Managed Provider to be able to fill DataSets from XML in a homogeneous way. This way you could mix XML and database data together without having to know exactly which is from which.

Usage Notes

  • The Connection string for the XmlConnection class takes a URL or File path to an XML file.
  • The XmlCommand class takes an optional XPath expression to decide which subset of the XML file to include in the DataSet.


    // call using: TestXml(@"c:\test.xml", "descendant::server[name='Kay']", 
    //                      "  ", "File Path with XPath Expression");

    static void TestXml(string URL, string XPath, string indent, string Title)
      Console.WriteLine("Testing {0} \nwith XML Source: {1}", Title, URL);
      XmlDataAdapter da = new XmlDataAdapter(XPath, new XmlConnection(URL));

      DataSet ds = new DataSet();
      // Test Filling in with all data
      int rowsAffected = da.Fill(ds);
      Console.WriteLine(indent + "Filled DataSet with {0} rows", rowsAffected);
      string xml = ds.GetXml();

      // Test Filling with Schema only
      DataTable[] aTables = da.FillSchema(ds, SchemaType.Source);
      Console.WriteLine(indent + "Filled DataSet with {0} tables of Schema only", 

      // Show XML if XPath is used
      if (XPath != "/") Console.WriteLine(indent + "XPath Results: \n{0}", xml);


  • The DataReader was never implemented.
  • This Managed Provider is read-only. If you need to write with it, please contact me as I might be able to get something working.
  • When using an XPath expression in the XmlCommand class, only the first Match is loaded into the DataSet.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Shawn Wildermuth

United States United States
No Biography provided

Comments and Discussions

Generallooking forward to more on this... Pinsusstim mackey1-Nov-02 15:11 
QuestionWhat is the point of this article? Pinmemberpbible14-Jul-02 6:43 
AnswerRe: What is the point of this article? PinmemberShawn Wildermuth14-Jul-02 9:16 
I appreciate your comment, but the Caveat section clearly states what is not implemented. I only implemented the parts of hte provider I needed for my project. I've been meaning to get back to it, but it'll be a while before I can get to it.
GeneralRe: What is the point of this article? PinmemberAKourkoumelis8-Mar-04 10:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150327.1 | Last Updated 17 Apr 2002
Article Copyright 2002 by Shawn Wildermuth
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid