- From: Jeff Faath <jfaath@gmail.com>
- Date: Thu, 14 Jan 2010 13:34:19 -0600
- To: xmlschema-dev@w3.org
- Message-ID: <db1f4bc11001141134q65b4807br9f522d44faee7b36@mail.gmail.com>
Greetings, I have a general question about creating a schema that is generic (from the business point of view) vs non-generic. I was wondering if I could get advice from experts on the advantages or pitfalls of these two methods. I'm inexperienced with building XML documents so I don't have the foresight I would like to have. One method might look nicer now, but I'm worried it might have issues with future processing and extendability needs. The question is probably best explained with an example. We have multiple client applications that send data readings to a central processor. The context of the readings differ based on which application it came from. We anticipate having more applications in the future that send more contextual data. The schema is more complicated than this, but this sums up the issue: Generic <root> <data type="appA"> <reading>X</reading> <reading>Y</reading> </data> <data type="appB"> <reading>1</reading> <reading>2</reading> </data> <root> Non-generic <root> <appAdata> <appAreading>X</appAreading> <appAreading>Y</appAreading> </appAdata> <appBdata> <appBreading>1</appBreading> <appBreading>2</appBreading> </appBdata> <root> In the first example, the schema is much simpler with just three elements. The type of data is determined by the 'type' attribute and that allows for understanding the context of the reading values. Having a new app installed in the system would not require changing the schema. In the second example, there are elements for each app and corresponding readings. The context is found in the explicit elements. Adding a new app would require adding a new element to the schema (and re-generating binding classes). The first example seems so much nicer, but I can't help but think there may be some pitfalls to keeping it so clean. The second example seems verbose, but being explicit leaves no room for doubt when processing. Might anyone have some insight in how to go about this? Is there some middle ground between the two methods? Regards, JF
Received on Friday, 15 January 2010 08:58:00 UTC