users@jaxb.java.net

Strange problem, please help

From: Alejandro Escalante Medina <alex.escalante_at_gmail.com>
Date: Tue, 14 Apr 2009 06:42:24 -0700

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/