Using Xml Schemas

Posts   
 
    
Posts: 27
Joined: 23-May-2006
# Posted on: 23-May-2006 09:41:02   

Hi,

I have a scenario where I have to store xml messages in a RDBMS. I've setup my LLBLGen project for the database. Now I need to find a way to exchange the information in de xml messages with my Entities and visa versa. I have xml schemas (.xsd) for all my xml messages.

I considered using xsd.exe to generate classes for my xml messages, but that leaves me we a lot of glue-code to write to copy all the property values from my xml-classes to my Entity classes and visa versa.

I know LLBLGen supports reading and writing Xml, but as I understand it, there's no escaping the LLBLGen format (verbose or compact)...

Any suggestions would be welcom.

Thanx, Marc Jacobi

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 23-May-2006 13:31:10   

I think you should do the mapping yourself. either directly from the xml messages or from the classes that you can create with their schema.

Posts: 27
Joined: 23-May-2006
# Posted on: 23-May-2006 13:37:25   

Could you xml serialize direclty onto the entities? Where would I put the XmlAttributes on the generated code?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 23-May-2006 14:26:12   

You want to store an xmldocument inside a property? As that's what I understand from your first post.

You can't use a custom format and deserialize it into entities. You can get llblgenpro xml from other xml by using an XSLT which converts from one XML format to another. Though if you want to store a piece of XML inside a field, it's a different story.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 27
Joined: 23-May-2006
# Posted on: 23-May-2006 15:19:09   

No, sorry. I'm not trying to fit an xml document into a single property.

I have an xml document that is to be stored in a structured way in the database. So my document contains more than one db-entity. I have to transform the xml into entities and store them into the database as seperate entities.

PS: you guys are really quick. Perfect! Great! smile

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 23-May-2006 17:07:05   

I just wrote a large program to parse XML files and insert into databases, but I used datasets instead of LLBLGenPro. As much as I like the latter, I didn't see any advantage to adding an object layer, when all I needed to do was insert some data into the database.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 24-May-2006 10:57:12   

I think you then indeed need to use an XSLT to convert nodes from your big document into xml nodes which you can feed to ReadXml() of an entity.

Frans Bouma | Lead developer LLBLGen Pro