Hi all,
Is it possible to write a schema allowing mixing validated XML with just well-formed XML? Case in point is a data transfer application where requests consist of a bunch of meta-data (which we'd like to validate) and record-specific information (which is validated separately from the XML in the business logic, because the XML requests are just one of several ways through which requests can come in).
Example:
<request>
<campaign>CAMP00001</campaign>
<username>user_bob</username>
<token>one-time-token-goes-here</token>
... more meta-data ...
<records>
<record id="90209">
<name>John Doe</name>
<address>Park Lane 191</address>
<postal>99999</postal>
</record>
<record id="90210">
<name>Jane Doe</name>
<address>Park Lane 192</address>
<postal>88888</postal>
</record>
</records>
</request>
Currently I'm validating by manually checking for the presence and validity of the content of the campaign, username and token fields. If possible, I'd like to do this using an XML schema so that it becomes easier to communicate to developers what meta-data they need to supply and in which formats - for campaigns, this is impossible as each campaign has its own set of fields and rules that are applied to those. Can such a thing be done?
(one solution I thought of is filling record with a set of <data>
elements instead of named elements, and then have a very loose definition of <data>
in the schema.. but that'd require changing the specs around)