[xsd-users] Handling of complex restrictions on types
Yury Zaytsev
yury.zaytsev at traveltainment.de
Thu Mar 19 12:23:38 EDT 2015
Hi,
In relation to my previous posts about enums, I'm now wondering what's the
general strategy of the generator with respect to complex restrictions on
types, and string types in particular.
I've had a look at the generated code, and so far was unable to find
anything that handles them, so is it correct to assume that they are
simply ignored at the moment, or am I missing something obvious?
In my schemas, I have a lot of restrictions of this kind:
<xs:simpleType name="TagNameType">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="30"/>
<xs:pattern value="[A-Za-z0-9\.\-_|]+"/>
</xs:restriction>
</xs:simpleType>
Ideally, I would like to have all of them checked at runtime, so that the
constructors and/or setters would raise an exception when the restrictions
are not adhered to.
Just to clarify why this is important to me: I expect to be generating the
XML files of sizes in the rage of hundreds of gigabytes, and at this scale
they take a very substantial amount of time to fully validate against the
original schema. Therefore, the earlier I can catch the problems with the
data, the better...
Potentially, I can re-implement these restrictions manually in the code,
but on one hand, it's a large amount of work, and, on the other hand, it's
hardly maintainable, because as soon as the restrictions change in the
schema, my code immediately gets out of sync with it.
The latter is exactly the situation I was trying to avoid by using an
automatic data bindings generator... Any thoughts?
Many thanks,
--
Dr. Yury V. Zaytsev
Senior Software Developer
IT Data Production
TravelTainment GmbH
Carlo-Schmid-Straße 12
52146 Würselen/Aachen, Germany
yury.zaytsev at traveltainment.de
http://www.traveltainment.de
Amtsgericht Aachen, HRB 15873
Geschäftsführer: Bernhard Steffens (Vorsitzender),
Dr. Oliver Rengelshausen
More information about the xsd-users
mailing list