You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Alexander Smirnoff <as...@vistar.ca> on 2002/07/16 17:25:57 UTC

Using Schematron for XML request validation

Hi all,

I'm considering to use SchematronValidator for validation of XML 
requests (embedded in the body of HTTP requests). Since XML 
Forms validation is dealing with forms and validation of JavaBeans,
I have a different problem.

The question I have is somewhat general. 

I would like to use schema for populating some report object in 
the case the validation succeeds. Probably it should be a different 
procedure, but does it looks more natural to have it there?

<schema xmlns:sch="http://www.ascc.net/xml/schematron" >
    <title>Test<title>
    <pattern name="GetAccountInfo">
        <rule context="/Request/GetAccountInfo">
            <assert test="@username and @password">No username and password attributes</assert>
            <report  test="@username and @password">
                <bean name="GetAccountInfo">
                    <attribute name="username"><value-of select="@username"></attribute>
                    <attribute name="password"><value-of select="@password"></attribute>
                    <attribute name="handle">account_info.xsp<attribute>
                </bean>
            </report>
        <rule>
    <pattern>
</schema>

Then I can pass it to specific hanle or even redirect the request.
Would it be a violation of Schematron schema and if not, how could I implement this?

Thanks,
Alex.



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Using Schematron for XML request validation

Posted by Ivelin Ivanov <iv...@apache.org>.
XMLForm will populate JavaBeans, DOM nodes or mixed.

Schematron is simple to use and powerful in what it does.
I wouldn't put extra burden on it.

My suggestions is to either use plain Java code to populate your fields or
write a specialized transformer.


Ivelin



----- Original Message -----
From: "Alexander Smirnoff" <as...@vistar.ca>
To: <co...@xml.apache.org>
Sent: Tuesday, July 16, 2002 10:25 AM
Subject: Using Schematron for XML request validation


> Hi all,
>
> I'm considering to use SchematronValidator for validation of XML
> requests (embedded in the body of HTTP requests). Since XML
> Forms validation is dealing with forms and validation of JavaBeans,
> I have a different problem.
>
> The question I have is somewhat general.
>
> I would like to use schema for populating some report object in
> the case the validation succeeds. Probably it should be a different
> procedure, but does it looks more natural to have it there?
>
> <schema xmlns:sch="http://www.ascc.net/xml/schematron" >
>     <title>Test<title>
>     <pattern name="GetAccountInfo">
>         <rule context="/Request/GetAccountInfo">
>             <assert test="@username and @password">No username and
password attributes</assert>
>             <report  test="@username and @password">
>                 <bean name="GetAccountInfo">
>                     <attribute name="username"><value-of
select="@username"></attribute>
>                     <attribute name="password"><value-of
select="@password"></attribute>
>                     <attribute name="handle">account_info.xsp<attribute>
>                 </bean>
>             </report>
>         <rule>
>     <pattern>
> </schema>
>
> Then I can pass it to specific hanle or even redirect the request.
> Would it be a violation of Schematron schema and if not, how could I
implement this?
>
> Thanks,
> Alex.
>
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>