VAST XML Mapping and Schemas

One thing that I got bitten by several times in the past is that you need to use a Schema file together with XML parsing in order to define whether an attribute should be serialized as an attribute of a tag or as a subtag.

In order to do so, you need to add a schema to the XmlObjectCache’s current singleton and make the parser use that schema. I’m not sure I’ve found the correct way to do so, and if so, I’m not sure how you would achieve that instances of some class can be mapped differently in two different contexts.

Say we have a class named Customer that should be serialized with all its attributes in context of a full crm export file, but in context of an export for envelope printing, we need to write different tags for the same class.

Maybe somebody has some notes on the topic they can share…


One thought on “VAST XML Mapping and Schemas

  1. What you could do is create one ‘mother’ schema. For every instance inherit from this schema, but adept it element according to your needs. This child schema is the one to give to the parser. Make sure the reference to the mother is correct.

    I haven’t implemented something like this yet, so don’t ask for more details. This is the way we plan to go at my job.


Comments are closed.