[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Wildcards and JBossXb Builder

adrian@jboss.org do-not-reply at jboss.com
Wed Mar 5 06:52:38 EST 2008


"alesj" wrote : OK, I see.
  | What's the workaround/fix then? :-)

The fix is for you to learn xsd, XSD 1.0.1 :-)

e.g.

  | <policy xmlns="urn:jboss:policy:1.0">
  | 
  |    <binding name="somename">
  | 
  |       <value xmlns="urn:jboss:bean-deployer:2.0" class="java.lang.Integer">42</value>
  | 
  |    </binding>
  | 
  | </policy>
  | 
  | 

There is no such element in the MC schema. The element is only defined
on the types where it is used, eg.


  |    <xsd:complexType name="entryType">
  |       <xsd:annotation>
  |          <xsd:documentation>
  |             <![CDATA[
  |             An entry in map. These are made of key/value pairs
  |             
  |             e.g.:
  |             <entry><key>default</key><value>http://localhost</value>
  |             ]]>
  |          </xsd:documentation>
  |       </xsd:annotation>
  |       <xsd:sequence>
  |          <xsd:element name="key" type="valueType" minOccurs="0"/>
  | <!-- HERE -->
  |          <xsd:element name="value" type="valueType" minOccurs="0"/>
  |       </xsd:sequence>
  |    </xsd:complexType>
  | 

If you want it as an element that can be used in other schemas then you need
to add a top level element:

  |    <xsd:element name="value" type="valueType">
  |       <xsd:annotation>
  |          <xsd:documentation>
  |            <![CDATA[
  |            A value.
  |            ]]>
  |          </xsd:documentation>
  |       </xsd:annotation>
  |    </xsd:element>
  | 

and change the XB annotations (don't do this! it is just an example, it is wrong)

  | @XmlRootElement(name="value")
  | @XmlType(name="valueType")
  | @JBossXmlNoElements
  | public class AbstractValueMetaData extends JBossObject
  | 

In practice. The AbstractValueMetaData isn't really the valueType.

Instead that is a group defined here:

  | @JBossXmlGroup
  | ({
  |    @JBossXmlChild(name="array", type=AbstractArrayMetaData.class),
  |    @JBossXmlChild(name="collection", type=AbstractCollectionMetaData.class),
  |    @JBossXmlChild(name="inject", type=AbstractDependencyValueMetaData.class),
  |    @JBossXmlChild(name="list", type=AbstractListMetaData.class),
  |    @JBossXmlChild(name="map", type=AbstractMapMetaData.class),
  |    @JBossXmlChild(name="null", type=AbstractValueMetaData.class),
  |    @JBossXmlChild(name="set", type=AbstractSetMetaData.class),
  |    @JBossXmlChild(name="this", type=ThisValueMetaData.class),
  |    @JBossXmlChild(name="value", type=StringValueMetaData.class),
  |    @JBossXmlChild(name="value-factory", type= AbstractValueFactoryMetaData.class)
  | })
  | @JBossXmlGroupText(wrapper= StringValueMetaData.class, property="value")
  | @JBossXmlGroupWildcard(wrapper= AbstractValueMetaData.class, property="value")
  | public interface ValueMetaData extends JBossInterface, MetaDataVisitorNode
  | 

The group isn't what you want for the wildcard element. :-)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134184#4134184

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134184



More information about the jboss-dev-forums mailing list