- From: Josef Dietl <josef@mozquito.com>
- Date: Tue, 24 Jul 2001 19:04:46 +0200
- To: "Roman Huditsch" <r.huditsch@hico.com>, <www-forms@w3.org>
Hi Roman and all, this was a really excellent question. Big thanks to all the colleagues from the working group who have contributed to the following answer on short notice. As always, please be aware that the following reflects the current thinking of some members of the working group, but not necessarily the consensus. As this is built on work in progress (namely a specification in Working Draft stage), the technology described is still subject to change. Note that your feedback can actually contribute to such changes, even though I can't promise that we can take your opinion into account. To business: For the time being, let's have a look at the two simplest examples. They correspond to very different scenarios, and depending on where you come from you will most likely consider only one of the two "simple". Let us keep in mind that the goal of the model is to provide run-time input validation to the user. There are two possible starting points: Case 1: If you start from scratch and want to add validation features, the simplest approach is to use the built-in datatypes of XML Schema, in conjunction with the "XML Schema instance" mechanism. In other words, there is no model separate from the instance, instead, the instance itself is annotated with datatypes. Based on Roman's example, this would look like: <xf:instance> <notiz> <username xsi:type="xsd:string" /> <persoenlicheNotiz xsi:type="xsd:string" /> <datum xsi:type="xsd:date" /> <titel xsi:type="xsd:string" /> <text xsi:type="xsd:string" /> </notiz> </xf:instance> (assuming the following namespace declarations are in force: xmlns:xf="http://www.w3.org/2001/06/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance") NOTE THAT because of the original choice of data model, the original scenario is very difficult to validate (separately storing day from month and year doesn't tell us whether the <tag>31</tag> is valid or not... this depends on the month, and, in the case of <tag>29</tag><monat>02</monat> even on the year). My reformulation is easier to handle because it builds on the existing Schema datatype "date" - don't worry, we will ultimately provide a user friendly way to enter a date. Anyway, if you want to know the gory details of this mechanism, please have a look at http://www.w3.org/TR/xmlschema-0/#attribute-xsi:type or your favorite text on XML Schemas. Case 2: You start with a Schema, possibly one that someone else has provided for you. In that case, simply write <xf:model xl:href="(URL of Schema)" /> and be done with it. (assuming the following namespace declarations are in force: xmlns:xf="http://www.w3.org/2001/06/xforms" xmlns:xl="http://www.w3.org/1999/xlink") The instance must then conform to that Schema. But keep in mind that not all XForms processors are required to support the full XML Schema. So far, it is settled that for the "full" conformance profile of XForms, both examples must work and that for the "basic" conformance profile the above Case 1 must work. It is also clear that it will be possible to define your own "simple types" for XForms basic. XForms basic will not support Schema "complex types". Further messages will cover the grey area between these two examples over the next few weeks, e.g. how to define and use datatypes in XForms Basic. Please let us know what you think, whether these examples work in your scenario and, most important, if they don't, what is missing. Regards, Josef Dietl P.S.: the terms "simple type" and "complex type" are part of the XML Schema terminology. Who here needs explanations in order to follow the discussion, and who is sufficiently fluent to proceed without? Which of the two scenarios above applies to you? > -----Original Message----- > From: Roman Huditsch [mailto:r.huditsch@hico.com] > Sent: Monday, July 23, 2001 10:11 AM > To: www-forms@w3.org > Subject: <model>- declaration > > > Good morning everybody! > > Could someone please give me an concrete example of a <model>- > declaration? I've seen so many different possibilities so far > that I've > no clue any more how to declare it. > I just want to define an element called "Tag" which should be based on > the datatype "day" and so on. > Would it be possible to write: > > <xform:model> > <xsd:simpleType name="day"> > <xsd:restriction > base="xsd:gDay"> > </xsd:restriction> > </xsd:simpleType> > <xsd:simpleType name="month"> > <xsd:restriction > base="xsd:gMonth"> > </xsd:restriction> > </xsd:simpleType> > <xsd:simpleType name="year"> > <xsd:restriction > base="xsd:gYear"> > </xsd:restriction> > </xsd:simpleType> > </xform:model> > > > <xform:instance> > <notiz> > <username /> > <persoenlicheNotiz /> > <datum> > <tag type="day"/> > <monat type="month"/> > <jahr type="year"/> > </datum> > <titel /> > <text /> > </notiz> > </xform:instance> > > Or would it be better to declare it like this: > > <model> > <day name="tag" required="true"....> > <month name="monat" required="true" ....> > </model> > > Yours, > Roman > > > Roman Huditsch (RH ) > > > _____________________________________________________________________ > > hico Informations- und Kommunikations-Management Gesellschaft m.b.H. > > TechLab, Thomas A. Edison Straße 2. > > A-7000 Eisenstadt / Austria > > phone: +43/2682/704-61-00; fax: +43/2682/704-71-61-10 > > e-mail:support@hico.com; r.huditsch@hico.com > > > > > >
Received on Tuesday, 24 July 2001 13:04:48 UTC