Login  Register

Re: Re: Re: Re: Re: Re: Re: Validation Response

Posted by Erik Bruchez on Mar 10, 2011; 2:36am
URL: https://discuss.orbeon.com/Validation-Response-tp3230774p3345062.html

Brian,

Thanks for the reproducible case.

The good news for is that it's not really a bug in Orbeon: you have simply been a victim of the "default XML namespace" catch.

In your pipeline, you have a default namespace:

xmlns="http://jnet.state.pa.us/jxdm/aopc"

This will put every element without a prefix in your document in that namespace, including the <config> and <decorate> elements.

This means that the validation processor doesn't recognize the configuration elements as they are in the wrong namespace.

Now you would think that the validation processor would tell you that the configuration is incorrect, like most other processors do!

This is where there is another catch: the validation processor doesn't validate its own config input with a schema as doing this naively causes recursion in the pipeline engine. An ad-hoc mechanism would be needed for this.

In the meanwhile, if you remove the default namespace from the root element, validation works as expected.

-Erik

On Mon, Feb 21, 2011 at 3:06 PM, bsteuhl <[hidden email]> wrote:

Eric,

If you create an application called schemaService and create the three files
listed below in that folder you can create a RESTful service like I did.  In
SOAPUI create a a new project and check the box to Create a new rest service
using your location information.  At the end of this message l also provide
the xml for SOAPUI test.

XPL file called 'validate.xpl'

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
         xmlns:oxf="http://www.orbeon.com/oxf/processors"
                 xmlns:delegation="http://orbeon.org/oxf/xml/delegation"
                 xmlns:aopc="http://jnet.state.pa.us/jxdm/aopc"
                 xmlns="http://jnet.state.pa.us/jxdm/aopc"
                 xmlns:j="http://www.it.ojp.gov/jxdm/3.0"
                 xmlns:v="http://orbeon.org/oxf/xml/validation"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

       <p:param type="input" name="instance"/>
       <p:param type="output" name="data"/>

       <p:processor name="oxf:validation">
               <p:input name="config">
                       <config>
                               <decorate>true</decorate>
                       </config>
               </p:input>
               <p:input name="schema" href="test.xsd"/>
               <!--<p:input name="schema" href="CourtFiling.xsd"/>-->
               <p:input name="data" href="#instance"/>
               <p:output name="data" id="data" />
       </p:processor>

       <!-- prepare config for the file-serializer -->

       <p:processor name="oxf:xslt">
               <p:input name="data" href="#data"/>
               <p:input name="config">
                       <xsl:stylesheet version="2.0"
xmlns:aopc="http://jnet.state.pa.us/jxdm/aopc"
                 xmlns="http://jnet.state.pa.us/jxdm/aopc"
                 xmlns:j="http://www.it.ojp.gov/jxdm/3.0"
                 xmlns:v="http://orbeon.org/oxf/xml/validation">
                               <xsl:template match="/">
                                       <document xsi:type="xs:string" content-type="text/plain">
                                               <xsl:copy-of select="/" />
                                       </document>
                               </xsl:template>
                       </xsl:stylesheet>
               </p:input>
               <p:output name="data" ref="data"/>
       </p:processor>

       </p:config>

page-flow.xml

<config xmlns="http://www.orbeon.com/oxf/controller">

       <page path-info="/schemaService/" view="validate.xpl"></page>

       <epilogue url="oxf:/config/epilogue.xpl"/>

</config>

Schema file called test.xsd

<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.org/schemaValidation"
xmlns:tns="http://www.example.org/schemaValidation"
elementFormDefault="qualified">
   <element name="test" type="tns:testType"></element>

       <complexType name="testType">
               <sequence>
                       <element name="select">
                               <simpleType>
                                       <restriction base="string">
                                               <enumeration value="Yes"/>
                                               <enumeration value="No"/>
                                       </restriction>
                               </simpleType>
                       </element>
               </sequence>
       </complexType>

</schema>

And here is the xml for SOPAUI:

<test xmlns="http://www.example.org/schemaValidation">
<select>No</select>
</test>

If you put in Yes or No the validation succeeds.  Anything else the Orbeon
HTML error is thrown instead of decorating mode with error tags.

Let me know if you need anything else.

Brian Steuhl
http://btmsoftwaresolutions.com BTM Software Solutions
--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Validation-Response-tp3230774p3318315.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




--
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