[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Namespaces, W3C XML Schema (was Re: ANN: SAX Filters forNamespaceProcessing)
- From: Elliotte Rusty Harold <elharo@metalab.unc.edu>
- To: Michael Brennan <Michael_Brennan@Allegis.com>,Xml-Dev <xml-dev@lists.xml.org>
- Date: Wed, 22 Aug 2001 18:55:43 -0400
At 1:42 PM -0700 8/22/01, Michael Brennan wrote:
>> On the other hand, over the last three years as I've taught
>> developers about DTDs, almost invariably the first question
>> is "How do I say that an element contains an int?" and the
>> second question is usually ""How do I say that an element
>> contains a year since 1969?" or some variant thereof.
>
>In other words, people want data-binding, but they want it to be simple.
>
No, this isn't data binding at all. It's validation. It's being presented with a set of quantities and verifying that those quantities meet certain predetermined constraints.
For example, suppose somebody sends me a SOAP request which among other things contains a SocialSecurity element whose text is supposed to be a social security number. I may want to verify that this number contains exactly 11 digits and two hyphens before I stick it in my database using JDBC and a String variable. This is perfectly reasonable and useful thing to do. It in no way requires that I define a SocialSecurity class or an ElevenDigitString class or anything else that isn't a normal, every day part of Java. You may want to do create these classes, and you're free to do so, but this is in no way the only way to use schemas.
Following the same approach, a complex schema might define 100s of types. I might pull all of those types into my programs from XML documents as the single Java type String. I might then turn around and stuff them all in a SQL database as INT, DATE, CHAR[32], and maybe a dozen other standard SQL types.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible, 2nd Edition (Hungry Minds, 2001) |
| http://www.ibiblio.org/xml/books/bible2/ |
| http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/ |
+----------------------------------+---------------------------------+