users@jaxb.java.net

Re: Strange problem, please help

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Wed, 15 Apr 2009 13:22:38 +0200

If I compile the schema snippet with xjc 2.1.3 (with JDK 1.6) I get a class
for Notify containing two List fields (one with NotificationMessage elements
and another one with Object elements) , and that's the way it should be.

From what information do you derive the necessity of the "wrapper" <arg0>?

Could you please post the generated code for Notify.java, and make sure to
keep the xjc version which is in a comment.

-W




On 4/14/09, Alejandro Escalante Medina <alex.escalante_at_gmail.com> wrote:
>
> Well, maybe I wasn't very clear in my last message, so I will re-state my
> problem here.
>
> I have this schema fragment from OASIS WS-I Notification spec (
> http://docs.oasis-open.org/wsn/b-2.xsd):
>
> <!-- ================== Message Helper Types ===================== -->
> <xsd:complexType name="NotificationMessageHolderType" >
> <xsd:sequence>
> <xsd:element ref="wsnt:SubscriptionReference"
> minOccurs="0" maxOccurs="1" />
> <xsd:element ref="wsnt:Topic"
> minOccurs="0" maxOccurs="1" />
> <xsd:element ref="wsnt:ProducerReference"
> minOccurs="0" maxOccurs="1" />
> <xsd:element name="Message">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:any namespace="##any" processContents="lax"
> minOccurs="1" maxOccurs="1"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
>
> <xsd:element name="NotificationMessage"
> type="wsnt:NotificationMessageHolderType"/>
>
> <!-- ========== Message Types for NotificationConsumer =========== -->
> <xsd:element name="Notify" >
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element ref="wsnt:NotificationMessage"
> minOccurs="1" maxOccurs="unbounded" />
> <xsd:any namespace="##other" processContents="lax"
> minOccurs="0" maxOccurs="unbounded"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
>
>
> A valid fragment for this schema could be the following:
>
> <ns1:Notify xmlns:ns1="http://docs.oasis-open.org/wsn/b-2">
> <ns1:NotificationMessage>
> <ns1:SubscriptionReference>
> ...
>
> However, the code generated by xjc won't parse such a thing, instead, it
> wants an extra element between <Notify> and <NotificationMessage>:
>
> <b:Notify>
> <arg0>
> <b:NotificationMessage>
> <b:SubscriptionReference>
>
> ... the question is, obviously: why?
>
> Also note that the "ghost tag" doesn't have any namespace. I am not an
> expert but this seems strange.
>
> So, I can't find the way for the generated classes to parse the first
> fragment, which is the correct one according to the spec and to at least one
> schema validator I tried.
>
> Any ideas?
>
> Please, any help will be appreaciated...
>
>
> Alejandro Escalante Medina
> Visita mi página personal en http://weblocked.blogsome.com/
>