You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Ajith Ranabahu <aj...@gmail.com> on 2005/08/04 10:59:23 UTC

[Axis2]Clarifications on XMLBeans

Hi all,
As you all know we have been successfully using XMLBeans for data binding in 
Axis2. However right now, we seem to have some problems with XMLBeans.

1. Some schemas are not compiled right by XMLBeans.Consider the following 
schema snippet.
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="
http://SimpleTest.org/xsd">
<element name="echoString">
<complexType>
<sequence>
<element name="inputString" type="xsd:string" nillable="true"/>
</sequence>
</complexType>
</element>
</schema>

The inputString element should belong to the targetNamespace. However the 
generated EchoStringDocument has the nested inputString in the empty Name 
space ?

2. The XMLBeans compiler fails to run inside Maven and Eclipse (and even 
Idea :)). David Jencks has been kind enough to provide us some good 
references and a code snippet but we still have some problems in running the 
tool inside maven and Eclipse. However , the Ant task works.

Any helpful hints in resolving these are welcome. I'll be sending these to 
the XMLBeans list as well.

Thanks

-- 
Ajith Ranabahu

Re: [Axis2]Clarifications on XMLBeans

Posted by Srinath Perera <he...@gmail.com>.
To elaborate on the #2, when we try to code gen from the AntTask the
code failed giving an
Initialization exception. It is fixed when we add the ClassLoader that
include the xml beans jar to the TCCL (Thread Context ClassLoader).
This works fine when it is only Ant, but failed when it is maven!

I belive  xmlbeans should accept a ClassLoader and use that in any
case where the reflection is needed. So far I do not find such
mechnisum yet. Relaying on the TCCL instead would be troublesome in
some enviorments like maven.



On 8/4/05, Ajith Ranabahu <aj...@gmail.com> wrote:
> Hi all,
> As you all know we have been successfully using XMLBeans for data binding in
> Axis2. However right now, we seem to have some problems with XMLBeans.
> 
> 1. Some schemas are not compiled right by XMLBeans.Consider the following
> schema snippet.
>  <schema xmlns="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://SimpleTest.org/xsd">
>         <element name="echoString">
>                <complexType>
>                  <sequence>
>                     <element name="inputString" type="xsd:string"
> nillable="true"/>
>                  </sequence>
>                </complexType>
>         </element>
>  </schema>
>  
>  The inputString element should belong to the targetNamespace. However the
> generated EchoStringDocument has the nested inputString in the empty Name
> space ?
>  
>  2. The  XMLBeans compiler fails to run inside Maven and Eclipse (and even
> Idea :)). David Jencks has been kind enough to provide us some good
> references and a code snippet but we still have some problems in running the
> tool inside maven and Eclipse. However , the  Ant task works.
>  
>  Any helpful hints in resolving these are welcome. I'll be sending these to
> the XMLBeans list as well.
>  
> Thanks
>  
> -- 
> Ajith Ranabahu
>

Re: [Axis2]Clarifications on XMLBeans

Posted by Glen Daniels <gl...@thoughtcraft.com>.
Hi Ajith!

> 1. Some schemas are not compiled right by XMLBeans.Consider the following 
> schema snippet.
> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="
> http://SimpleTest.org/xsd">
> <element name="echoString">
> <complexType>
> <sequence>
> <element name="inputString" type="xsd:string" nillable="true"/>
> </sequence>
> </complexType>
> </element>
> </schema>
> 
> The inputString element should belong to the targetNamespace. However the 
> generated EchoStringDocument has the nested inputString in the empty Name 
> space ?

XmlBeans is correct here.  The default for "elementFormDefault" is 
"unqualified", which means that local elements are in the empty 
namespace.  If the <schema> element had an attribute 
elementFormDefault="qualified", or if the inputString element looked 
like <element name="inputString" form="qualified">, you would then see 
the inputString element have the "http://SimpleTest.org/xsd" namespace.

--Glen

Re: [Axis2]Clarifications on XMLBeans

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
On Thu, 2005-08-04 at 14:59 +0600, Ajith Ranabahu wrote:
> Hi all,
> As you all know we have been successfully using XMLBeans for data
> binding in Axis2. However right now, we seem to have some problems
> with XMLBeans.
> 
> 1. Some schemas are not compiled right by XMLBeans.Consider the
> following schema snippet.
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://SimpleTest.org/xsd">
>        <element name="echoString">
>               <complexType>
>                 <sequence>
>                    <element name="inputString" type="xsd:string"
> nillable="true"/>
>                 </sequence>
>               </complexType>
>        </element>
> </schema>
> 
> The inputString element should belong to the targetNamespace. However
> the generated EchoStringDocument has the nested inputString in the
> empty Name space ?

No .. look for elementFormQualified in the XSD spec .. unless you set
that to true the child elements are not qualified. IIRC the default of
that is false.

> 2. The  XMLBeans compiler fails to run inside Maven and Eclipse (and
> even Idea :)). David Jencks has been kind enough to provide us some
> good references and a code snippet but we still have some problems in
> running the tool inside maven and Eclipse. However , the  Ant task
> works.
> 
> Any helpful hints in resolving these are welcome. I'll be sending
> these to the XMLBeans list as well.

No idea :(.

Sanjiva.




Re: [Axis2]Clarifications on XMLBeans

Posted by David Jencks <dj...@apache.org>.
On Aug 4, 2005, at 1:59 AM, Ajith Ranabahu wrote:

> Hi all,
> As you all know we have been successfully using XMLBeans for data 
> binding in Axis2. However right now, we seem to have some problems 
> with XMLBeans.
>
> 1. Some schemas are not compiled right by XMLBeans.Consider the 
> following schema snippet.
>  <schema xmlns="http://www.w3.org/2001/XMLSchema" 
> targetNamespace="http://SimpleTest.org/xsd">
>         <element name="echoString">
>                <complexType>
>                  <sequence>
>                     <element name="inputString" type="xsd:string" 
> nillable="true"/>
>                  </sequence>
>                </complexType>
>         </element>
>  </schema>
>
>  The inputString element should belong to the targetNamespace. However 
> the generated EchoStringDocument has the nested inputString in the 
> empty Name space ?
>
>  2. The  XMLBeans compiler fails to run inside Maven and Eclipse (and 
> even Idea :)). David Jencks has been kind enough to provide us some 
> good references and a code snippet but we still have some problems in 
> running the tool inside maven and Eclipse. However , the  Ant task 
> works.
>
>  Any helpful hints in resolving these are welcome. I'll be sending 
> these to the XMLBeans list as well.
I suggest you use the xmlbeans2 maven plugin available at 
http:cvs.apache.org/repository/xmlbeans/plugins/

A typical dependency element looks like

         <dependency>
             <groupId>xmlbeans</groupId>
             <artifactId>xmlbeans-maven-plugin</artifactId>
             <version>2.0.0-beta1</version>
             <type>plugin</type>
         </dependency>

please let me or the xmlbeans dev list know if you have any problems 
with it.  In particular I haven't figured out where the ant plugin 
likes to put the source schemas, and I'm not sure I am duplicating that 
behavior by default.

I don't know how to run xmlbeans from eclipse :-)

thanks
david jencks


>
> Thanks
>
> -- 
> Ajith Ranabahu