mardi 5 février 2019

How to deal with different XML templates in one class

We have a order database with orders which contains orderlines. Every orderline has a product. The product can be purchased from different suppliers. That means that in one order it can have multiple orderlines each purchased at a different supplier. Eventually we are going to send a purchase order in XML format to these suppliers. The problem is that every supplier has their own XML template. So there will be not 1 XML. How can I best generalize this? I was thinking to create a class for each supplier in which I have strings like this:

Parent>child>child

So for example supplier A has:

Order>Ordernumber

Another class will eventually read out this class and then create the XML elements from it. Is this a good practice? Are there maybe also design patterns for this?

Aucun commentaire:

Enregistrer un commentaire