Loading an Entity Collection from an .XML File

Posts   
 
    
MT10
User
Posts: 4
Joined: 28-Dec-2004
# Posted on: 31-Dec-2004 11:34:39   

Hello.

How can I load an Entity collection from a xml file. The .xml file contains a correct dataset structure as it's save from a dataset.

Basically, I wish to build a small website that usses LLBL Gen and reads data from pre-saved recordset ( .xml local files)

Best Regards & happy new year to all of you.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 31-Dec-2004 13:58:25   

I think the easiest way to do it is to load the xml in a dataset again and walk all rows in the datatable and instantiate entities from that.

You can also use an XSLT to convert the XML to xml of the format WriteXml() spits out for that particular entitycollection, but that's a hit hard, unless you're a real xml/xslt expert.

Frans Bouma | Lead developer LLBLGen Pro
MT10
User
Posts: 4
Joined: 28-Dec-2004
# Posted on: 31-Dec-2004 14:54:41   

So Enitity Collection are loaded only from dbs. I think it could be a nice idea to extend them to support XML Offline recordset sunglasses

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 31-Dec-2004 18:10:39   

That's already build in: An entity collection can be written to XML using WriteXml and read back using ReadXml(). The problem is: if you have xml in another format you first have to convert it to the format ReadXml can understand. Which is pretty hard I think.

Frans Bouma | Lead developer LLBLGen Pro