Hello,
I have to write a validation framework for quite complex structure,
and I decided to use XML-schema and Castor for it's undoubting beauty.
However, the structure includes mutual exclusion of some elements
and/or its combinations. I've tried to solve this problem using
xs:chioce and xs:sequence constructs. For example:
<xs:element name="EntrObsCall">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element name="obsdigit" type="T_OBSDIGIT"/>
<xs:sequence>
<xs:element name="lac" type="T_LAC"/>
<xs:element name="dn" type="T_DN"/>
</xs:sequence>
</xs:choice>
<xs:element name="obsgrp" type="T_OBSGRP"/>
<xs:element name="intercom" type="YES_NO" minOccurs="0"/>
...
Castor source generator generates classes, but the main class
EntrObsCall doesn't contain method like setDn or setLac. Instead of that
it contains classes called EntrObsCallChoice, but this not suitable for
me. I am reading data from some strange source and I need the data
insert into this object (for example) using java reflection api.
(Application should be as simple as possible - new data type <==> new
schema, new generated class)
Q1: Is there some way how to generate such a class from such an XMLschema?
Q2: The second approach could be: I'll generate 2 schemas. First as
complex as I described above and second one simpler "flat" schema (which
should produce all needed setters). I'll the "flat" object with the data
-> marshal it into String and then unmarshal into "complex" object and
validate against the "complex" schema. Is it possible to do a simple
marshalling into "complex" object (using Castor)? (Simple = call a
framework method without need to create additional classes (because
intent is to handle all changes and new forms of incoming data without
need to write java code - just a new XML schema)
Thank you in advance,
Yours faithfully Stefan
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev