XMLSchema validation

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

XMLSchema validation

Ralf Jung
Hi list,

to smoothen the communication between the Orbeon frontend and the eXist
database I am using as backend, and to have this properly documented, I'd like
to make all the XML data passed between the two validated by XMLSchema. I am
however completely new to the topic of Schema validation, so I might have some
completely wrong assumptions ;-)

As a start, I'd like Orbeon to validate the result of a submission from eXist.
The format is really simple, and I managed to write an XSD that Orbeon
accepted and that is in the namespace "com.red-db.services". I then added the
name of the XSD file to the model of my XForms page and set
xxforms:validation="strict" in the instance the submission puts its data in.
However, even though the data eXist sends is not in that namespace (and I also
changed some attribute names around), Orbeon does not show any error of any
kind. It does not seem to even validate anything.
Unfortunately, the section "Validation and Submissions" at
http://wiki.orbeon.com/forms/doc/developer-guide/xforms-validation just says
"TODO".

I also do not understand how I am supposed to properly validate multiple
instances: Of course I can put multiple <xs:element> declarations in my XSD
file, but then any instance could contain any root, which is not really what I
want. Or am I supposed to create one XForms model per instance?

I'm thankful for any hints,
Ralf Jung


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XMLSchema validation

Ralf Jung
Can't anybody help on this? I'd really like to use proper validation for the
communication.

Kind regards,
Ralf Jung

Am Freitag 03 Juni 2011, um 16:11:00 schrieb Ralf Jung:

> Hi list,
>
> to smoothen the communication between the Orbeon frontend and the eXist
> database I am using as backend, and to have this properly documented, I'd
> like to make all the XML data passed between the two validated by
> XMLSchema. I am however completely new to the topic of Schema validation,
> so I might have some completely wrong assumptions ;-)
>
> As a start, I'd like Orbeon to validate the result of a submission from
> eXist. The format is really simple, and I managed to write an XSD that
> Orbeon accepted and that is in the namespace "com.red-db.services". I then
> added the name of the XSD file to the model of my XForms page and set
> xxforms:validation="strict" in the instance the submission puts its data
> in. However, even though the data eXist sends is not in that namespace
> (and I also changed some attribute names around), Orbeon does not show any
> error of any kind. It does not seem to even validate anything.
> Unfortunately, the section "Validation and Submissions" at
> http://wiki.orbeon.com/forms/doc/developer-guide/xforms-validation just
> says "TODO".
>
> I also do not understand how I am supposed to properly validate multiple
> instances: Of course I can put multiple <xs:element> declarations in my XSD
> file, but then any instance could contain any root, which is not really
> what I want. Or am I supposed to create one XForms model per instance?
>
> I'm thankful for any hints,
> Ralf Jung


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XMLSchema validation

Karolin Heiss
Hello Ralf

I work with multiple XForms models. Each model has its own schema:

<xforms:model id="MyModel1">
  <xs:schema>
    ...
  </xs:schema>
  <xforms:instance id="MyInstance1">
    ...
  </xforms:instance>
</xforms:model>


<xforms:model id="MyModel2">
  <xs:schema>
    ...
  </xs:schema>
  <xforms:instance id="MyInstance2">
    ...
  </xforms:instance>
</xforms:model>

Client side validtion works fine and for the event xforms-invalid I disable the submit button:

<xforms:action ev:event="xforms-invalid">
  <xforms:setvalue ref="$control/submit">false</xforms:setvalue>
</xforms:action>

Maybe that helps.

Cheers,
Karolin

Reply | Threaded
Open this post in threaded view
|

Re: Re: XMLSchema validation

Ralf Jung
Hi,

> I work with multiple XForms models. Each model has its own schema:
Okay, that's a good work-around, thanks!


> Client side validtion works fine and for the event xforms-invalid I disable
> the submit button:
>
> <xforms:action ev:event="xforms-invalid">
>   <xforms:setvalue ref="$control/submit">false</xforms:setvalue>
> </xforms:action>
These values are not edited by the user, they are retrieved from the database
via REST. I want Orbeon to validate what the database sent. Is that possible?

Kind regards,
Ralf Jung


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: XMLSchema validation

Erik Bruchez
Administrator
In reply to this post by Ralf Jung
Ralf,

Currently we don't load more than one schema per model. So the
solution that Karolin presents is possible. Or, someone could add
support for multiple schemas: it shouldn't be that hard ;)

Now say you have only one schema to make things simpler. Then
certainly schema validation should happen on the instance with the
strict mode.

Now how do you check for errors? With controls bound to nodes of that
instance? Do they have xforms:alert elements?

-Erik

On Tue, Jun 14, 2011 at 1:36 AM, Ralf Jung <[hidden email]> wrote:

> Can't anybody help on this? I'd really like to use proper validation for the
> communication.
>
> Kind regards,
> Ralf Jung
>
> Am Freitag 03 Juni 2011, um 16:11:00 schrieb Ralf Jung:
>> Hi list,
>>
>> to smoothen the communication between the Orbeon frontend and the eXist
>> database I am using as backend, and to have this properly documented, I'd
>> like to make all the XML data passed between the two validated by
>> XMLSchema. I am however completely new to the topic of Schema validation,
>> so I might have some completely wrong assumptions ;-)
>>
>> As a start, I'd like Orbeon to validate the result of a submission from
>> eXist. The format is really simple, and I managed to write an XSD that
>> Orbeon accepted and that is in the namespace "com.red-db.services". I then
>> added the name of the XSD file to the model of my XForms page and set
>> xxforms:validation="strict" in the instance the submission puts its data
>> in. However, even though the data eXist sends is not in that namespace
>> (and I also changed some attribute names around), Orbeon does not show any
>> error of any kind. It does not seem to even validate anything.
>> Unfortunately, the section "Validation and Submissions" at
>> http://wiki.orbeon.com/forms/doc/developer-guide/xforms-validation just
>> says "TODO".
>>
>> I also do not understand how I am supposed to properly validate multiple
>> instances: Of course I can put multiple <xs:element> declarations in my XSD
>> file, but then any instance could contain any root, which is not really
>> what I want. Or am I supposed to create one XForms model per instance?
>>
>> I'm thankful for any hints,
>> Ralf Jung
>
>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: XMLSchema validation

Ralf Jung
Hi,

> Currently we don't load more than one schema per model. So the
> solution that Karolin presents is possible. Or, someone could add
> support for multiple schemas: it shouldn't be that hard ;)
I see. Well, the problem is I am currently XIncluding the model into the form
to keep the logic and the view in different files. That would no longer work
since the model would have several roots. Maybe I should use XSLT, the page
does not have that much traffic so not being able to cache should not be too
much of a drawback. I assume instance('name') works across all models?

> Now say you have only one schema to make things simpler. Then
> certainly schema validation should happen on the instance with the
> strict mode.
Correct, the "multiple schemas" is not currently my main problem.

> Now how do you check for errors? With controls bound to nodes of that
> instance? Do they have xforms:alert elements?
I do not check for errors at all. The data is received through a submission
from an eXist XQuery, stored in an instance and used by a xf:select1. If it is
invalid, that's not the users fault but mine. I expected Orbeon to reject the
submission and print an error in the log (and maybe for the user, too) that
the data was invalid.
The goal is to make sure that application frontend (Orbeon) and backend
(eXist) both obey the protocol, and at the same time to document the protocol
with the XMLSchema files. Of course I could still do the latter without Orbeon
even knowing, but the point was that Orbeon and eXist should check whether the
other side sends valid data, or not.
It seems instance validation has a different purpose, but can I (mis-)use it to
achieve above effect?

Kind regards,
Ralf Jung


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XMLSchema validation

tulay34
In reply to this post by Ralf Jung
Hi Ralf,

you can use this free xml schema validator tool, it should do what you require, let me know how you get on,

thanks
Reply | Threaded
Open this post in threaded view
|

Re: XMLSchema validation (Abwesenheit)

Karolin Heiss
Guten Tag,

ich bin am 20.06. nicht im Büro und werde die E-Mail später beantworten.

Schöne Grüsse, Karolin Krieg

>>> "tulay34 [via Orbeon Forms (ops-users)]" <[hidden email]> 06/20/11 15:51 >>>



Hi Ralf,

you can use this free
http://www.liquid-technologies.com/FreeXmlTools/FreeXmlSchemaValidator.aspx
xml schema validator  tool, it should do what you require, let me know how
you get on,

thanks

_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://orbeon-forms-ops-users.24843.n4.nabble.com/XMLSchema-validation-tp3570908p3611439.html

To unsubscribe from XMLSchema validation, visit
Reply | Threaded
Open this post in threaded view
|

Re: Re: XMLSchema validation (Abwesenheit)

Ralf Jung
Hi,

uh, how exactly can I embed this into Orbeon...?

Kind regards,
Ralf

> Hi Ralf,
>
> you can use this free
> http://www.liquid-technologies.com/FreeXmlTools/FreeXmlSchemaValidator.aspx
> xml schema validator  tool, it should do what you require, let me know how
> you get on,
>
> thanks
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://orbeon-forms-ops-users.24843.n4.nabble.com/XMLSchema-validation-tp3
> 570908p3611439.html
>
> To unsubscribe from XMLSchema validation, visit
> http://orbeon-forms-ops-users.24843.n4.nabble.com/template/NamlServlet.jtp
> ?macro=unsubscribe_by_code&node=3570908&code=S2Fyb2xpbi5LcmllZ0BhYmFjdXMuY2
> h8MzU3MDkwOHwtNzk5MTY1ODk4
>
>
> --
> View this message in context:
> http://orbeon-forms-ops-users.24843.n4.nabble.com/XMLSchema-validation-tp3
> 570908p3611441.html Sent from the Orbeon Forms (ops-users) mailing list
> archive at Nabble.com.


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: XMLSchema validation (Abwesenheit)

Karolin Heiss
Guten Tag,

ich bin am 20.06. nicht im Büro und werde die E-Mail später beantworten.

Schöne Grüsse, Karolin Krieg

>>> "Ralf Jung [via Orbeon Forms (ops-users)]" <[hidden email]> 06/20/11 16:44 >>>



Hi,

uh, how exactly can I embed this into Orbeon...?

Kind regards,
Ralf

> Hi Ralf,
>
> you can use this free
> http://www.liquid-technologies.com/FreeXmlTools/FreeXmlSchemaValidator.aspx
> xml schema validator  tool, it should do what you require, let me know how
> you get on,
>
> thanks
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://orbeon-forms-ops-users.24843.n4.nabble.com/XMLSchema-validation-tp3
> 570908p3611439.html
>
> To unsubscribe from XMLSchema validation, visit
> http://orbeon-forms-ops-users.24843.n4.nabble.com/template/NamlServlet.jtp
> ?macro=unsubscribe_by_code&node=3570908&code=S2Fyb2xpbi5LcmllZ0BhYmFjdXMuY2
> h8MzU3MDkwOHwtNzk5MTY1ODk4
>
>
> --
> View this message in context:
> http://orbeon-forms-ops-users.24843.n4.nabble.com/XMLSchema-validation-tp3
> 570908p3611441.html Sent from the Orbeon Forms (ops-users) mailing list
> archive at Nabble.com.


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws


_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://orbeon-forms-ops-users.24843.n4.nabble.com/XMLSchema-validation-tp3570908p3611572.html

To unsubscribe from XMLSchema validation, visit
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: XMLSchema validation

Erik Bruchez
Administrator
In reply to this post by Ralf Jung
> much of a drawback. I assume instance('name') works across all models?

It doesn't, as per the XForm spec.

But you can use xxforms:instance(), which goes across models. This is
sometimes ok, sometimes dangerous due to inter-model dependencies not
being really handled.

>> Now how do you check for errors? With controls bound to nodes of that
>> instance? Do they have xforms:alert elements?
> I do not check for errors at all. The data is received through a submission
> from an eXist XQuery, stored in an instance and used by a xf:select1. If it is
> invalid, that's not the users fault but mine. I expected Orbeon to reject the
> submission and print an error in the log (and maybe for the user, too) that
> the data was invalid.

XForms does not prevent you from having invalid data.

What xforms:submission does by is this:

* upon sending a request: unless you turn that off, it will stop the
submission if the data to send contains invalid nodes
* upon receiving a response: the data is stored wherever you tell it
to be stored; if the received data is invalid, it is still stored into
the instance, but instance validation will mark nodes as invalid as
needed

> The goal is to make sure that application frontend (Orbeon) and backend
> (eXist) both obey the protocol, and at the same time to document the protocol
> with the XMLSchema files. Of course I could still do the latter without Orbeon
> even knowing, but the point was that Orbeon and eXist should check whether the
> other side sends valid data, or not.
> It seems instance validation has a different purpose, but can I (mis-)use it to
> achieve above effect?

Not sure if my answer above helps on this point?

-Erik


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: XMLSchema validation (Abwesenheit)

Karolin Heiss
Guten Tag,

ich bin am 20.06. nicht im Büro und werde die E-Mail später beantworten.

Schöne Grüsse, Karolin Krieg

>>> "Erik Bruchez [via Orbeon Forms (ops-users)]" <[hidden email]> 06/21/11 07:50 >>>



> much of a drawback. I assume instance('name') works across all models?

It doesn't, as per the XForm spec.

But you can use xxforms:instance(), which goes across models. This is
sometimes ok, sometimes dangerous due to inter-model dependencies not
being really handled.

>> Now how do you check for errors? With controls bound to nodes of that
>> instance? Do they have xforms:alert elements?
> I do not check for errors at all. The data is received through a submission
> from an eXist XQuery, stored in an instance and used by a xf:select1. If it is
> invalid, that's not the users fault but mine. I expected Orbeon to reject the
> submission and print an error in the log (and maybe for the user, too) that
> the data was invalid.

XForms does not prevent you from having invalid data.

What xforms:submission does by is this:

* upon sending a request: unless you turn that off, it will stop the
submission if the data to send contains invalid nodes
* upon receiving a response: the data is stored wherever you tell it
to be stored; if the received data is invalid, it is still stored into
the instance, but instance validation will mark nodes as invalid as
needed

> The goal is to make sure that application frontend (Orbeon) and backend
> (eXist) both obey the protocol, and at the same time to document the protocol
> with the XMLSchema files. Of course I could still do the latter without Orbeon
> even knowing, but the point was that Orbeon and eXist should check whether the
> other side sends valid data, or not.
> It seems instance validation has a different purpose, but can I (mis-)use it to
> achieve above effect?

Not sure if my answer above helps on this point?

-Erik


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws


_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://orbeon-forms-ops-users.24843.n4.nabble.com/XMLSchema-validation-tp3570908p3613246.html

To unsubscribe from XMLSchema validation, visit
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: XMLSchema validation

Ralf Jung
In reply to this post by Erik Bruchez
Hi Erik,

> XForms does not prevent you from having invalid data.
>
> What xforms:submission does by is this:
>
> * upon sending a request: unless you turn that off, it will stop the
> submission if the data to send contains invalid nodes
> * upon receiving a response: the data is stored wherever you tell it
> to be stored; if the received data is invalid, it is still stored into
> the instance, but instance validation will mark nodes as invalid as
> needed
Hm, that's basically the other way around from how I need it - when validating
data of a protocol between two parties, it hardly makes sense to let the
sender do the validation ;-) . So, it looks like I can not do what I planned.
I hoped it to be a nice "learning XMLSchema" project, but the structures are
fairly simple,so I guess I will keep it the way it is, since XForms was not
designed for what I need.

Thanks a lot for your replies!
Ralf


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Re: XMLSchema validation

Erik Bruchez
Administrator
>> * upon sending a request: unless you turn that off, it will stop the

>> submission if the data to send contains invalid nodes
>> * upon receiving a response: the data is stored wherever you tell it
>> to be stored; if the received data is invalid, it is still stored into
>> the instance, but instance validation will mark nodes as invalid as
>> needed
> Hm, that's basically the other way around from how I need it - when validating
> data of a protocol between two parties, it hardly makes sense to let the
> sender do the validation ;-) . So, it looks like I can not do what I planned.
> I hoped it to be a nice "learning XMLSchema" project, but the structures are
> fairly simple,so I guess I will keep it the way it is, since XForms was not
> designed for what I need.
Well you could still find a solution:

1. Disable validation upon submission with validate="false" on the
submission, and
2. Store the response into a separate instance validated by that same
schema. Then if that instance is valid, copy it to its final
destination, otherwise ignore it or report an error,

-Erik


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Re: Re: XMLSchema validation

Ralf Jung
Hi Erik,

> Well you could still find a solution:
>
> 1. Disable validation upon submission with validate="false" on the
> submission, and
> 2. Store the response into a separate instance validated by that same
> schema. Then if that instance is valid, copy it to its final
> destination, otherwise ignore it or report an error,
Using the xxforms:valid function? Thanks for the hint, I will look into it.
But it will make the code so much longer and more complicated, I am not sure
if it is worth it.

Kind regards,
Ralf


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Re: Re: Re: XMLSchema validation

Erik Bruchez
Administrator
> Using the xxforms:valid function? Thanks for the hint, I will look into it.
> But it will make the code so much longer and more complicated, I am not sure
> if it is worth it.

I guess it depends what your alternative is. This would require an
extra instance and an xforms:insert running if the response is valid.
I don't know if it's that much more code but it is certainly longer
than a validation mechanism that would block the submission result
automatically.

-Erik

>
> Kind regards,
> Ralf
>
>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws