Hello.

I'm trying to make extensions using xml schema substitution groups.

Schema has following definition:

<xs:element name="notification-providers"
type="notification-providers-config" />

<xs:complexType name="notification-providers-config">
<xs:sequence>
<xs:element ref="notification-provider" minOccurs="0" maxOccurs="unbounded"
/>
</xs:sequence>
</xs:complexType>

<xs:element name="notification-provider" type="notification-provider-config"
abstract="true" />

<xs:complexType name="notification-provider-config" />

<xs:element name="dc-global-chat-notification-provider-config"
substitutionGroup="notification-provider">
<xs:complexType>
<xs:complexContent>
<xs:extension base="notification-provider-config" />
</xs:complexContent>
</xs:complexType>
</xs:element>

<xs:element name="dc-private-chat-notification-provider-config"
substitutionGroup="notification-provider">
<xs:complexType>
<xs:complexContent>
<xs:extension base="notification-provider-config" />
</xs:complexContent>
</xs:complexType>
</xs:element>

XML example:
<notification-providers>
<dc-global-chat-notification-provider-config />
</notification-providers>

After schemagen the following binding xml produced:
  <mapping abstract="true" type-name="ns1:notification-providers-config"
class="by.smoke.jdcbot.config.NotificationProvidersConfig">
    <collection item-type="by.smoke.jdcbot.config.NotificationProvider"
get-method="getNotificationProviders" set-method="setNotificationProviders"
create-type="java.util.ArrayList"/>
  </mapping>
  <mapping class="by.smoke.jdcbot.config.NotificationProvider"
name="notification-provider">
    <structure map-as="ns1:notification-provider-config"/>
  </mapping>
  <mapping abstract="true" type-name="ns1:notification-provider-config"
class="by.smoke.jdcbot.config.NotificationProviderConfig"/>
  <mapping
class="by.smoke.jdcbot.config.DcGlobalChatNotificationProviderConfig"
name="dc-global-chat-notification-provider-config">
    <structure map-as="ns1:notification-provider-config"/>
  </mapping>
  <mapping
class="by.smoke.jdcbot.config.DcPrivateChatNotificationProviderConfig"
name="dc-private-chat-notification-provider-config">
    <structure map-as="ns1:notification-provider-config"/>
  </mapping>

and the following classes:
NotificationProvidersConfig containing a List of NotificationProvider
NotificationProviderConfig
NotificationProvider extends NotificationProviderConfig
DcGlobalChatNotificationProviderConfig extends NotificationProviderConfig
DcPrivateChatNotificationProviderConfig extends NotificationProviderConfig

When I'm trying to compile these binding the error occured: factory-method
needed for abstract type 'by.smoke.jdcbot.config.NotificationProvider'; on
mapping element at ...

What am I doing wrong?

And the second question is why NotificationProvidersConfig contains
a List of NotificationProvider but not a List of NotificationProviderConfig?

Also I've tried to remove abstract attribute from notification-provider
element's schema definition, bindings compilation succeeded and I've got a
error during xml unmarshaling: Expected "notification-providers" end tag,
found "dc-global-chat-notification-provider-config" start tag.

Thanks in advance.
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to