Custom Xml Serialization

Posts   
 
    
ferhaad
User
Posts: 5
Joined: 05-Nov-2007
# Posted on: 05-Nov-2007 18:34:08   

Hi,

I am total newbie with XML and LLBLGEN. I am working on a project where we are using LLBLGen and I have been asked to implement custom serialization of the entity classes. I have been trying to figure out how to handle and implement xml serialization in the llblgen generated classes but all went in vein. I am not to use the llblgen provided xml serialization.

I am stuck in how to handle the entity classes and entitycollection classes in my project. My XSD is like this <SongEntity> <AudioEntity> <Artisit> Collection of artisit </Artist> <Album> Collection of Albums </Album> <Media> Collection of Media </Media> </AudioEntity> <SongEntity>

Now I need to access each and every object of the entity class / entitycollection class and xml serialize them all. How do I acheive this by using llblgen provided facilities? Also I have the relationclasses generated by the llblgen. How do I go about the collection through relation classes?

I have gone through the documentation of llblgen v2.5. But can't seem to digest it...please provide me a code snippet to better understand the working between the entity classes, collection and relation classes.

Thanks Ferhaad

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 06-Nov-2007 09:51:34   

I think you should develop your own routine that accepts an Entity/Collection and returns the required XML.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 06-Nov-2007 11:25:52   

You can also do: - use the Compact25 form of XML output by LLBLGen Pro, this is very close to what you would target for anyway - use an XSLT to transform that XML into your own format. That's the purpose of XSLT anyway.

Why are you re-implementing the XML serialization btw? You'll run into nasty things like cycles in the graph, interface typed properties and the like, stuff which the XmlSerializer can't handle but our own code can. So instead of re-doing what we've already done for you, isn't it better to simply utilize what LLBLGen Pro already puts out in XML format?

Frans Bouma | Lead developer LLBLGen Pro