You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Manuel <ma...@ilch.de> on 2009/04/27 16:35:38 UTC

Question about schema-validation-enabled

Hi,

I'am new to cxf.

the situation:

I publish a service wiht the following properties
    <jaxws:properties>
        <entry key="schema-validation-enabled" value="true" />
    </jaxws:properties>

I have a wsdl description as follows
    <xs:any maxOccurs="unbounded" minOccurs="0" namespace="##other"
processContents="skip"/>

the problem:
the complex type containing the above xs:any element with
processcontents skip holds a list with DOM elements
List<org.w3c.dom.Element>

and therefore the resulting XML contains xml elements which are not
definiet in a schema, therefore the processContent attribute is given.
but the following error occurs:

Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a:
Invalid content was found starting with element 'row'. One of
'{WC[##other

If I set the schema-validation-enabled to false the follwoing result
is given back:
<ns2:return><row><market...  and so on...

Summary:
I think there is something wrong. I enabled schema validation but the
framework should not validate the content of the return element...
.but it obviously dont work as I expected ...

can anyone help ?

thanks in advance

greetings manuel

Re: Question about schema-validation-enabled

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
Manuel wrote:
>     <xs:any maxOccurs="unbounded" minOccurs="0" namespace="##other"
> processContents="skip"/>

namespace="##other" permits any element that is in a namespace which is
different from the target namespace of the schema.  It specifically does
*not* permit elements that are not in a namespace at all[1], which is
the case for your <row> element:

> <ns2:return><row><market...  and so on...

If you control the WSDL and want to allow unqualified elements then you
need to change it to namespace="##local" instead of ##other.  If you
need to allow both qualified and unqualified use ##any.

However, ##any does allow elements in the schema's target namespace.  If
you need to allow qualified or unqualified but still preserve the
##other restriction (i.e. allow anything but the target namespace) then
you'd need a construction like:

<xs:choice maxOccurs="unbounded" minOccurs="0">
  <xs:any namespace="##other" processContents="skip" />
  <xs:any namespace="##local" processContents="skip" />
</xs:choice>

Ian

[1] http://www.w3.org/TR/xmlschema-0/#nsTable

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK