- From: David E. Cleary <davec@progress.com>
- Date: Thu, 26 Jul 2001 10:28:02 -0400
- To: "Roman Huditsch \(by way of \"Masayasu Ishikawa\" <mimasa@w3.org>\)" <r.huditsch@hico.com>, <www-forms@w3.org>
> Refering to Josef's last eMail, I would like to know how you would > define your own datatypes. > Would you create them in the xform:model tag? and which namespace do you > have to use in that case? > As far as I've understood the idea it would look like this: > > <xform:model> > <xsd:simpleType name="email"> > <xsd:restriction > base="xsd:string"/> > ...... > </xsd:simpleType> > </xform:model> > > <xform:instance> > <email xsi:type="xform:email" xform:readonly="true"/> > ... > > </xform:instance> > > > Is that right or did I got something wrong? The name attribute on the simpleType element is a QName. This means that the way you have written it, it would be in a default namespace, if one was declared. If there is no default namespace, then it would not be in any, and should be unprefixed in the instance. However, this is prone to bugs because adding a default namespace somewhere in the hierarchy would change the name of your type. When working with a full schema, it is considered a best practice that if you use a default namespace, that it be the target namespace of the schema. In the case of xforms, I would declare my own namespace that would contain my type deffinitions. If the namespace is declared higher up the chain (<xhtml> element for instance) then it doesn't have to be declared twice as shown below. <xform:model xmlns:my="mynamespace"> <xsd:simpleType name="my:email"> <xsd:restriction base="xsd:string"/> ...... </xsd:simpleType> </xform:model> <xform:instance xmlns:my="mynamespace"> <email xsi:type="my:email" xform:readonly="true"/> ... </xform:instance> David Cleary
Received on Thursday, 26 July 2001 10:28:04 UTC