- From: Jim Showalter <jim@jimandlisa.com>
- Date: 26 Jul 2005 07:46:12 -0600
- To: <www-xml-schema-comments@w3.org>
if improved, would make it a lot more powerful. My application has a complicated configuration file that has to be carefully checked by the application before proceeding. I wrote an XML Schema for the config file, in order to get XmlValidatingReader to do some of the checking so I wouldn't have to code it myself. Using all of the capabilities of XML Schema that I could, I was able to reduce the amount of code I had to write from 560 lines to 220 lines. But with a few more general capabilities in XML Schema, I could have eliminated all of my checking code. Here is what I found missing: 1) I needed a "contiguous" restriction. Yes, I can create sequences, and yes, I can create unique and key restrictions, but there was no way to say that there must not be gaps. For example, I could have a number ranging from 7 to 20, and I could establish a key on that number, which made sure that, say, the number 8 wasn't used twice, but I couldn't enforce that the numbers had to be sequential (7, 8, 9, etc.). It sure would have been useful to be able to say no gaps are allowed. 2) I needed a way to say that, if a number was used, then there had to be a keyref to that number. Why? Because my program is mapping one set of numbers to another (actually, they're columns in tables--I'm mapping input columns to output columns, with no gaps, and I need to make sure that every output column is mapped to by at least one input column). I couldn't have the numbers 1, 2, 3, and 4, and another set of numbers 1, 2, 3, with 4 left out. A general notion of ref counts would be really useful. It could have min and max ref counts, which would allow all kinds of flexible uses. A ref count with a min of 1 and max of 1 would mean that every key must have exactly one keyref to it. A ref count with a min of 1 and no max would mean that every key must have at least one keyref to it (which was the semantics I needed). A ref count with a min of 0 would mean that a key didn't have to be referred to, and so forth. 3) I needed a way to say that the max value for some attribute could not exceed the value of some other attribute. Generalized, it would be really useful to be able to have basic expressions for comparision (equal, not equal, greater than, less than, greater than or equal, less than or equal) of arbitrary fields in the schema. 4) It would be really nice to be able to specify error messages for error conditions in the XML Schema. I am currently relying on the error messages from the XML reader, but they tend to be pretty cryptic. Previously I had written my own messages, which were application-specific and quite informative. For example: theLogger.ConfigFileError("Specified config file contains output column heading base name '" + outputHeadingBaseName + "' with forbidden characters (only a-z, A-Z, and 0-9 are allowed)."); whereas now my application outputs messages like: The 'output-heading-base-name' attribute has an invalid value according to its data type. An error occurred at file:///C:/Documents and Settings/<filename goes here>, (21, 48). I would like to be able to hook my messages into the schema to override the default messages.
Received on Tuesday, 26 July 2005 13:47:52 UTC