[webbeans-dev] Typing of XML elements

Pete Muir pmuir at redhat.com
Thu Mar 19 08:40:21 EDT 2009


On 18 Mar 2009, at 04:38, Jason T. Greene wrote:

> Pete Muir wrote:
>> Hi Norman, and other XML experts,
>> One of the tasks for Web Beans is to build an XSD. There is an XSD  
>> per package, and an root-element per class. Classes can have  
>> annotations, such as bindings, which makes them into a bean. This  
>> means, for example, that a child element of the class element could  
>> be a binding type annotation (it's XML element equivalent), however  
>> placing, for example, an annotation which is not, for example, a  
>> binding type would be an error.
>> Therefore, we can increase the "type safety" of the XSD by  
>> restricting the category of child elements that can be placed in  
>> the class element. However, I don't know how to do this in XSD -  
>> any pointers?
>
> I'm not sure I understand what you want, however it sounds like a  
> substitution group. Can you give an example?

For example in package com.acme

class Foo {


}

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?

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

--
Pete Muir
http://www.seamframework.org
http://in.relation.to/Bloggers/Pete




More information about the weld-dev mailing list