[webbeans-dev] Typing of XML elements

Jason T. Greene jason.greene at redhat.com
Thu Mar 19 09:12:42 EDT 2009


Pete Muir wrote:

> could be described by XML:
> 
> <acme:Foo>
> 
> </acme:Foo>
> 
> Now, I want to add the binding com.acme.sales.Bar to the Foo class:
> 
> <acme:Foo>
>    <sales:Bar />
> </acme:Foo>
> 
> In other words, any binding type can be inserted as a child element to a 
> class. So, we need a way to identify this as a point that any binding 
> type can be inserted.
> 
> Does this explain it better?
> 

Ok, it does sound like this could be a substitution group.

<xs:element name="bindingElement" type="bindingType"/>

<xs:complexType name="classType">
   <xs:sequence>
     <xs:element ref="bindingElement"/>
   </xs:sequence>
</xs:complexType>

// in the sales namespace
<xs:element name="Bar" substitutionGroup="webbeans:bindingElement"/>

// in the acme namespace
<xs:element name="Foo" type="classType"/>


-- 
Jason T. Greene
JBoss, a division of Red Hat



More information about the weld-dev mailing list