You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by Ankit Bhatnagar <an...@yahoo.com> on 2011/11/21 22:36:26 UTC
Error with usertype
Hi,
I am getting a weird error while porting my build system to maven
xml Error /pathtoconf/xyz.xsdconfig:3:3: error: cvc-complex-type.2.4a: Expected elements 'namespace@http://xml.apache.org/xmlbeans/2004/02/xbean/config qname@http://xml.apache.org/xmlbeans/2004/02/xbean/config extension@http://xml.apache.org/xmlbeans/2004/02/xbean/config' instead of 'usertype@http://xml.apache.org/xmlbeans/2004/02/xbean/config' here in element config@http://xml.apache.org/xmlbeans/2004/02/xbean/config
xyz.xsdconfig
==========
<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config" xmlns:tns="blah">
<xb:usertype name="tns:duration" javaname="com.xyz.Duration">
<xb:staticHandler>com.xyz.DurationTypeHandler</xb:staticHandler>
</xb:usertype>
</xb:config>
The xsdconfig works fine with ant task but fails with maven.
Please ignore typos .
Ankit
Fw: Error with usertype
Posted by Ankit Bhatnagar <an...@yahoo.com>.
Hi Cezar,
I tried loading the xsd and xsd config differently and ow no error
However
<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config" xmlns:tns="blah">
<xb:usertype name="tns:duration"
javaname="com.xyz.Duration">
<xb:staticHandler>com.xyz.DurationTypeHandler</xb:staticHandler>
</xb:usertype>
</xb:config>
is never enforced.The Type in the generated class is always String instead of com.xyz.Duration
Actually wanted to check with you that- com.xyz.Duration above lies in a separate jar which I included in this project as a depedency
-Ankit
________________________________
From: Cezar Andrei <ce...@oracle.com>
To: dev@xmlbeans.apache.org; Ankit Bhatnagar <an...@yahoo.com>
Sent: Monday, November 21, 2011 6:46 PM
Subject: Re: Error with usertype
Ankit,
This seems to be related to some difference in the class loader. XMLBeans is making use of the class loader to load up the schema type system from files. These files need to be acessible as resources to the class-loader.
Cezar
On Nov 21, 2011, at 3:36 PM, Ankit Bhatnagar wrote:
Hi,
>
>
>I am getting a weird error while porting my build system to maven
>
>
>xml Error /pathtoconf/xyz.xsdconfig:3:3: error: cvc-complex-type.2.4a: Expected elements 'namespace@http://xml.apache.org/xmlbeans/2004/02/xbean/config qname@http://xml.apache.org/xmlbeans/2004/02/xbean/config extension@http://xml.apache.org/xmlbeans/2004/02/xbean/config' instead of 'usertype@http://xml.apache.org/xmlbeans/2004/02/xbean/config' here in element config@http://xml.apache.org/xmlbeans/2004/02/xbean/config
>
>
>
>xyz.xsdconfig
>
>==========
>
><xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config" xmlns:tns="blah">
>
> <xb:usertype name="tns:duration"
javaname="com.xyz.Duration">
> <xb:staticHandler>com.xyz.DurationTypeHandler</xb:staticHandler>
> </xb:usertype>
>
></xb:config>
>
>
>
>The xsdconfig works fine with ant task but fails with maven.
>
>
>Please ignore typos .
>
>
>Ankit
>
Re: Error with usertype
Posted by Cezar Andrei <ce...@oracle.com>.
Ankit,
This seems to be related to some difference in the class loader. XMLBeans is making use of the class loader to load up the schema type system from files. These files need to be acessible as resources to the class-loader.
Cezar
On Nov 21, 2011, at 3:36 PM, Ankit Bhatnagar wrote:
> Hi,
>
>
> I am getting a weird error while porting my build system to maven
>
>
> xml Error /pathtoconf/xyz.xsdconfig:3:3: error: cvc-complex-type.2.4a: Expected elements 'namespace@http://xml.apache.org/xmlbeans/2004/02/xbean/config qname@http://xml.apache.org/xmlbeans/2004/02/xbean/config extension@http://xml.apache.org/xmlbeans/2004/02/xbean/config' instead of 'usertype@http://xml.apache.org/xmlbeans/2004/02/xbean/config' here in element config@http://xml.apache.org/xmlbeans/2004/02/xbean/config
>
>
>
> xyz.xsdconfig
>
> ==========
>
> <xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config" xmlns:tns="blah">
>
> <xb:usertype name="tns:duration" javaname="com.xyz.Duration">
> <xb:staticHandler>com.xyz.DurationTypeHandler</xb:staticHandler>
> </xb:usertype>
>
> </xb:config>
>
>
>
> The xsdconfig works fine with ant task but fails with maven.
>
> Please ignore typos .
>
>
> Ankit