[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Required Field validation strategies
- From: "J Siatkowski" <jason.siatkowski@gmail.com>
- To: xml-dev@lists.xml.org
- Date: Tue, 20 Mar 2007 13:47:20 -0400
My thanks to both Stephen and Michael. I tinkered with the file and I
was able to get it successfully validated with just the xmlns
declaration. That makes me a lot happier.
The other issue, which I didn't discuss earlier because it might have
been moot based on the first issue, is my handling of null fields. My
schema does indeed have custom data types, i.e. string0to14, etc. It
also has some enumeration types. The schema also enforces required
fields, although I have been sorely tempted to remove this from the
schema because I have not been able to successfully validate a file
with nulls without adding xs:nil = "true" to the elements which I want
to be null. Only a small amount of the fields are required, and
therefore the size of the uploaded file could be a lot smaller if the
customer wasn't required to include the tags for elements which have
no value. In my tests, if I omitted the tag, the schema validation
failed because the tags were out of order. I also tried specifying a
default value for each field in the schema if it was null, but that
did not work well at all for date fields. A problem which I learned
was quite common from what I've read since then.
I would like to still use the schema so I can continue to read the
file into the dataset, but I think it would be useful to allow the
customer to supply only the tags that actually have values while still
performing required field validation.
Is this an all or nothing situation? It seems my choices are to allow
the schema to validate required fields and therefore require the
customer to provide all tags even if the data is null, or I can remove
required fields from the schema and just perform my validation in code
after the schema validation is performed.
Again, thanks for any advice,
--Jason
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]