W3C home > Mailing lists > Public > www-forms@w3.org > October 2005

RE: Populating select1 from a schema

From: Mark Birbeck <mark.birbeck@x-port.net>
Date: Mon, 3 Oct 2005 16:05:33 +0100
Message-ID: <1DFF0A8F-5E1A-4073-B946-7E8D15E35AB8@s15.mail.x-port.net>
To: "'Patricio Olivares'" <patolivares@gmail.com>, <www-forms@w3.org>

Hi Patricio,

I've read and re-read your message, and the only conclusion I can come to is
that you have slightly misunderstood how namespaces and prefixes work. If I
have misunderstood you, then I apologise, and perhaps you can try to explain
your question again.

Anyway, assuming I do understand you, then you only need one prefix for the
XML Schema in your XForms document, and it does *not* have to match the
prefix used in the instance data (especially because the instance data might
not even use a prefix). That's the whole point of the prefixes--just make
sure that it matches the namespace itself.

Regards,

Mark


Mark Birbeck
CEO
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
w: http://www.formsPlayer.com/
b: http://internet-apps.blogspot.com/

Download our XForms processor from
http://www.formsPlayer.com/ 

> -----Original Message-----
> From: www-forms-request@w3.org 
> [mailto:www-forms-request@w3.org] On Behalf Of Patricio Olivares
> Sent: 26 September 2005 20:04
> To: www-forms@w3.org
> Subject: Populating select1 from a schema
> 
> 
> Hi everybody,
> since as far as I know the xforms engine I'm using (x-smiles) 
> can't infer the listing of posible values from the validating 
> schema of the instance (in a select1 widget), I'm trying to 
> recover the values directly from the xsd.
> 
> The problem I'm having with this approach is how to reference 
> to the values (in itemset, via xpath). This is because the 
> natural prefix to use is "xsd:" but that approach doesn't 
> scale very well because I've no control over the file 
> "enum.xsd" and If I need to refer two enums (enum1.xsd and 
> enum2.xsd) from two select1 widgets, maybe the two schemas 
> are using the same prefix, so I can't distinguish between them.
> 
> Does anyone have any thoughts about this?. Is there a better 
> approach possible?
> 
> The following are code extracts that I'm using to test the issue.
> Thanks in advance.
> 
> -------------------
> 
> enum.xsd
> ========
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsd:schema
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>     targetNamespace="http://www.target/namespaces/enum"
>     version="1.0"
>     elementFormDefault="qualified"
>     attributeFormDefault="unqualified">
> 
>     <xsd:simpleType name="globalEnumType">
>         <xsd:restriction base="xsd:string">
>             <xsd:enumeration value="VAL1" />
>             <xsd:enumeration value="VAL2" />
>             <xsd:enumeration value="VAL3" />
>         </xsd:restriction>
>     </xsd:simpleType>
> </xsd:schema>
> 
> 
> xforms :: head
> ===============
> <xf:model id="idenum">
>     <xf:instance
>         src="enum.xsd"
>         xmlns:xsd="http://www.target/namespaces/enum" /> </xf:model>
> 
> 
> xforms :: body
> ==============
> <xf:select1 model="default" ref="/path/to/target/element">
>     <xf:label>Choose...</xf:label>
>     <xf:itemset model="idenum"
> nodeset="xsd:schema/xsd:simpleType/xsd:restriction/xsd:enumeration">
>         <xf:label ref="@value" />
>         <xf:value ref="@value" />
>     </xf:itemset>
> </xf:select1>
> 
> 
> 
> --
> Patricio Olivares
> 
> 
> 
Received on Monday, 3 October 2005 15:06:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:01 GMT