You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Raymond Feng <en...@gmail.com> on 2010/06/25 02:14:42 UTC

Schema validation of composite files that reference user XSDs

Hi,

The SCA composite file can reference user XSDs to specify the property type or element. For example,


<property name="p1" type="ns1:CustomerType" xmlns:ns1="http://customer">
	<value xsi:type="ns1:CustomerType">
		<ns1:name>Ray</ns1:name>
		<ns1:id>001</ns1:id>
	</value>
</property>


<property name="p1" element="ns1:customer" xmlns:ns1="http://customer">
	<ns1:customer>
		<ns1:name>Ray</ns1:name>
		<ns1:id>001</ns1:id>
	</ns1:customer>
</property>
 
The XSD for the customer is from the user application (could be packaged into the SCA contribution). Tuscany's schema validation against this composite fails as it
doesn't have knowledge of the user XSDs.

Should we validate the XML "foreign" to the SCA/Tuscany system XSDs? If yes, I guess the composite needs to have xsi:schemaLocation to provide the user XSDs. If not,
how can we fix the code to ignore the "foreign" XML elements/attributes/QNames?

Thanks,
Raymond
________________________________________________________________ 
Raymond Feng
rfeng@apache.org
Apache Tuscany PMC member and committer: tuscany.apache.org
Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
Personal Web Site: www.enjoyjava.com
________________________________________________________________


Re: Schema validation of composite files that reference user XSDs

Posted by Simon Laws <si...@googlemail.com>.
On Fri, Jun 25, 2010 at 1:14 AM, Raymond Feng <en...@gmail.com> wrote:
> Hi,
> The SCA composite file can reference user XSDs to specify the property type
> or element. For example,
>
> <property name="p1" type="ns1:CustomerType" xmlns:ns1="http://customer">
> <value xsi:type="ns1:CustomerType">
> <ns1:name>Ray</ns1:name>
> <ns1:id>001</ns1:id>
> </value>
> </property>
>
> <property name="p1" element="ns1:customer" xmlns:ns1="http://customer">
> <ns1:customer>
> <ns1:name>Ray</ns1:name>
> <ns1:id>001</ns1:id>
> </ns1:customer>
> </property>
>
> The XSD for the customer is from the user application (could be packaged
> into the SCA contribution). Tuscany's schema validation against this
> composite fails as it
> doesn't have knowledge of the user XSDs.
> Should we validate the XML "foreign" to the SCA/Tuscany system XSDs? If yes,
> I guess the composite needs to have xsi:schemaLocation to provide the user
> XSDs. If not,
> how can we fix the code to ignore the "foreign" XML
> elements/attributes/QNames?
> Thanks,
> Raymond
> ________________________________________________________________
> Raymond Feng
> rfeng@apache.org
> Apache Tuscany PMC member and committer: tuscany.apache.org
> Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
> Personal Web Site: www.enjoyjava.com
> ________________________________________________________________
>

Hi Raymond

A question first. Are you saying that both of the approaches to
defining p1 fail validation? I.e. both the one that defines and
explicit type and the one that doesn't.

Simon

-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Re: Schema validation of composite files that reference user XSDs

Posted by Mike Edwards <mi...@gmail.com>.
Raymond Feng wrote:
> Hi,
> 
> The SCA composite file can reference user XSDs to specify the property 
> type or element. For example,
> 
> 
> <property name="p1" type="ns1:CustomerType" xmlns:ns1="http://customer">
> <value xsi:type="ns1:CustomerType">
> <ns1:name>Ray</ns1:name>
> <ns1:id>001</ns1:id>
> </value>
> </property>
> 
> 
> <property name="p1" element="ns1:customer" xmlns:ns1="http://customer">
> <ns1:customer>
> <ns1:name>Ray</ns1:name>
> <ns1:id>001</ns1:id>
> </ns1:customer>
> </property>
>  
> The XSD for the customer is from the user application (could be packaged 
> into the SCA contribution). Tuscany's schema validation against this 
> composite fails as it
> doesn't have knowledge of the user XSDs.
> 
> Should we validate the XML "foreign" to the SCA/Tuscany system XSDs? If 
> yes, I guess the composite needs to have xsi:schemaLocation to provide 
> the user XSDs. If not,
> how can we fix the code to ignore the "foreign" XML 
> elements/attributes/QNames?
> 
> Thanks,
> Raymond
> /________________________________________________________________ 
> Raymond Feng
> rfeng@apache.org <ma...@apache.org>
> /Apache Tuscany PMC member and committer: tuscany.apache.org
> Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
> Personal Web Site: www.enjoyjava.com
> /
> ________________________________________________________________/
> 
Raymond,

I'm puzzled here.

If I use some XSD in one of my composites, I'd expect to have that XSD present in my contribution 
(or imported from some other contribution).

Are you saying that if I do this with the current codebase, it does not work?

If I want to reference some XSD that is on a remote location on the Web, then sure, 
xsi:schemaLocation is the way to go.

Yours,  Mike.