Applying schema to single instance

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Applying schema to single instance

mjgraham
Hi,

I have a model that contains several instances and a schema that only
needs to apply to one of them but if I do:

<xforms:model schema="myschema.xsd">

  <xforms:instance id="main">

  <xforms:instance id="data">

  <xforms:instance id="test">

</xforms:model>

then the schema will apply to all instances. How can I get to apply only
to the "main" instance?

    Cheers,

    Matthew



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Applying schema to single instance

Erik Bruchez
Administrator
Matthew,

There is no way to tell XForms to apply a schema only to a particular
instance. But it is quite possible that OPS doesn't apply schemas quite
correctly. The latest spec says:

"An instance node is valid if [...] the node satisfies any applicable
XML schema definitions [...]" ("any" actually meaning "all" here)

I assume this means that if a node doesn't have any applicable schema
definition, it does not become invalid, which is not what you observe.

As a workaround, until this is fixed, you could temporarily add
catch-all schema definitions for your other instances, something like:

<xs:element name="data">
     <xs:complexType>
         <xs:sequence>
             <xs:any namespace="##targetNamespace" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
     </xs:complexType>
</xs:element>

Or, you could try to put your other instances in another model, although
that can make your bindings more complicated as you may have to use the
@model attribute on controls a lot.

-Erik

Matthew Graham wrote:

> Hi,
>
> I have a model that contains several instances and a schema that only
> needs to apply to one of them but if I do:
>
> <xforms:model schema="myschema.xsd">
>
>  <xforms:instance id="main">
>
>  <xforms:instance id="data">
>
>  <xforms:instance id="test">
>
> </xforms:model>
>
> then the schema will apply to all instances. How can I get to apply only
> to the "main" instance?
>
>    Cheers,
>
>    Matthew
--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Applying schema to single instance

Erik Bruchez
Administrator
FYI I entered a bug to track this:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=306010&group_id=168&atid=350207

-Erik

Erik Bruchez wrote:

> Matthew,
>
> There is no way to tell XForms to apply a schema only to a particular
> instance. But it is quite possible that OPS doesn't apply schemas quite
> correctly. The latest spec says:
>
> "An instance node is valid if [...] the node satisfies any applicable
> XML schema definitions [...]" ("any" actually meaning "all" here)
>
> I assume this means that if a node doesn't have any applicable schema
> definition, it does not become invalid, which is not what you observe.
>
> As a workaround, until this is fixed, you could temporarily add
> catch-all schema definitions for your other instances, something like:
>
> <xs:element name="data">
>     <xs:complexType>
>         <xs:sequence>
>             <xs:any namespace="##targetNamespace" processContents="lax"
> minOccurs="0" maxOccurs="unbounded"/>
>         </xs:sequence>
>     </xs:complexType>
> </xs:element>
>
> Or, you could try to put your other instances in another model, although
> that can make your bindings more complicated as you may have to use the
> @model attribute on controls a lot.
>
> -Erik
>
> Matthew Graham wrote:
>> Hi,
>>
>> I have a model that contains several instances and a schema that only
>> needs to apply to one of them but if I do:
>>
>> <xforms:model schema="myschema.xsd">
>>
>>  <xforms:instance id="main">
>>
>>  <xforms:instance id="data">
>>
>>  <xforms:instance id="test">
>>
>> </xforms:model>
>>
>> then the schema will apply to all instances. How can I get to apply
>> only to the "main" instance?
>>
>>    Cheers,
>>
>>    Matthew
>

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws