XmlDataProvider - Recommend when using large files

Hello

I really enjoy the binding features in WPF for the xmldataprovider, really useful. My only problem is further down the road there is no support in my mind for setting the XmlDataProvider with an XmlReader only an in-memory XmlDocument.

After downloading the XPathReader from MSDN should there not by a XPathReader in V3 of the Framwork and an XmlDataProvider that streams data I can see my avalon app eating memory in occasions.

What do you recommend.

kind regards,

Andrew




Answer this question

XmlDataProvider - Recommend when using large files

  • champa

    I find XPath valuable for generating report (filtering) and most of my WPF work is bound read-only so there are some scenarios where two way binding isnt implicit (RSS Feeds for example).

    I would have been nice to feel that one could drop an xmldataprovider and feel that i would scale. I'm thinking of using the object dataprovider to manually implement getting around this...

    kind regards,



  • Floaf

    Sorry for the delayed response, but yes I would recommend actually creating a class (or series of classes) that represents your XML schema. It would actually save you room in memory because you don't have to deal with the over head that comes with the XML object model (or DOM).

  • libyan

    Yes this is the approch I have taken and think is the only best alternative.

    I set my DataContext equal to an 'ObservableCollection<DataRowProxy>' with each DataRowProxy being a JIT read from an XmlReader.

    It's not perfect as a thousand rows means the collection has a thousand elements but currently it's better than loading a 100MB xml file and getting 700+MB Virtual Memory Alloc



  • Deldy

    XPathReader (which I believe is a wrapper around SAX) is really not suited for binding, especially two way binding. It is the same reason why XmlReader isn't supported. If you only have a reader, you cant write. That is why XmlDataProvider only supports XmlDocument. Random access, read/write capabilities.

  • XmlDataProvider - Recommend when using large files