On Aug 25, 2009, at 7:14 PM, vaidya nathan wrote:
> This is a two part question
>
> First part(I)
> ==========
> How are these two way different?
> 1. <xs:element name="elemname" type="tns:elem_type" />
> <xs:complexType name="elem_type">
> <xs:sequence>
> <xs:element name="elem1" type="ns1:elem1_type"/>
> </xs:sequence>
> </xs:complexType>
>
> 2. <xs:element name="element">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="comment" type="xs:string"
> maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> The second one is generating the @XmlRootElement(name = "comments")
> whereas the first one is not when it goes through xjc .Any idea ? Is
> there a way to specify the element to be root in the schema? Is xjc
> program the culprit(I have tried with both the maven plugin and the
> xjc.bat way of generating the java classes)
It is probably an xjc thing, i am not an expert on it so i recommend
you email users_at_jaxb.dev.java.net.
> =
> =
> =
> =
> =
> =
> =
> =
> =
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> The second part is as follows.(II)
>
> When I try to use the jersey client wrapper and have the
> request to be one without the XmlRootElement (I way)
> clientResponse =
> createWebResource().accept(contentType).post(ClientResponse.class,
> request);
>
What is the type of "request" ?
> I get the following error message
> com.sun.jersey.api.client.ClientHandlerException:
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> at
> com
> .sun
> .jersey
> .client
> .urlconnection
> .URLConnectionClientHandler.handle(URLConnectionClientHandler.java:
> 128)
> at com.sun.jersey.api.client.Client.handle(Client.java:397)
> at com.sun.jersey.api.client.WebResource.handle(WebResource.java:
> 557)
Is there more to the exception, like the cause of the
ClientHandlerException?
What version of Jersey?
>
> Can jersey client only send root elements @XmlRootElement?
>
Or instance of JAXBElement i.e. JAXB artifacts that declare an XML
root element.
But it is not clear to me what the above error is (need to see the
checked exception), perhaps it could be related to serializing of the
"request" instance.
Paul.
> Regards
>
>
>