views:

161

answers:

2

In our company we have discussion going on whether to allow xml/xsd strucutures (used in webservices) that contain parts that are loosly-typed, in order to make changes to them easier.

What do you thing are the pro's and cons of doing one (loosly-typed) or the other (strictly-typed) ? Arguments could be in the categories, of ease of change, development effort, version control, etc.

A: 

The advantage of strictly typed XML is that your code does not need to contain a bunch of stuff of the form

  1. if A & B, and they haven't included a C, error and terminate
  2. If B or C, and the D section in E doesn't match the foobar, error and terminate

and so on. Strict XML for stuff that your logic depends on. Loose XML for stuff that you are just holding as data.

The disadvanatage is that you have to manage and version the xsds, but that's no more work than it would otherwise be, except that you catch problems earlier.

paulmurray
A: 

I have no pro´s for loosly-typed. You will only get into trouble with developing time, it will increase when they have to make a lot of code for detection of what type actually was returnes and validate it.

I do not think you gain so much in ease of change since the consumers still have to adapt to new types, if they need them or they get them anyway.

My suggestion is to follow an xsd and use versions instead.

I do not know what platform you are using, but with WCF you can let your service evolve by making new contracts at new endpoints of the same service.

Martin Bring