Usage of XSD xs:anyType



I want to have XML parsers for a couple of about 20 schemata, representing different sets of domain data. The instances share a common part INFO, but have an individual part DATA, which is different between the schemata. So the xml instances have all the same element type INFO, but different element types for DATA.


Now, when I receive a piece of XML, I want first to know, to which type of schema it belongs. This information is part of INFO. Then I parse against the right schema, to extract data. To find out the type, I want to implement a "common" parser, where DATA is of type=xs:anyType and its content is ignored during parsing, since I get data at the second step.


Since I dont't want to put all different domain types into one single schema, there is the disadvantage of not knowing in advance the right schema to apply. I could apply all different parsers and check for validation errors, but that is not very efficient.


Is this solution acceptable, or is the a better solution?


Many Thanks!


No comments:

Post a Comment