[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Getting content of XML element

adrian@jboss.org do-not-reply at jboss.com
Tue Nov 20 14:00:29 EST 2007


anonymous wrote : 
  |    <xsd:complexType name="annotationType">
  |       <xsd:annotation>
  |          <xsd:documentation>
  |            <![CDATA[
  |            A annotation override
  |            ]]>
  |          </xsd:documentation>
  |       </xsd:annotation>
  |       <xsd:complexContent>
  |          <xsd:attribute name="expr" type="xsd:string" use="required"/>
  |          <xsd:attribute name="invisible" type="xsd:string" use="required"/>
  |       </xsd:complexContent>
  |    </xsd:complexType>
  | 

Shouldn't his be in the JBossXB forum? :-)

You need to use either simpleContent and/or mixed=true

e.g. (with attributes - the alias type in the MC)

  |    <xsd:complexType name="aliasType" mixed="true">
  |       <xsd:annotation>
  |          <xsd:documentation>
  |             <![CDATA[
  |             Bean's aliases.
  | 
  |             e.g.
  |             <bean name="MyName" class="com.acme.POJO">
  |                <alias>YourName</alias>
  |                <alias><value class="java.lang.Class">com.acme.POJO</value></alias>
  |                <alias><value class="java.lang.Integer">1234</value></alias>
  |             </bean>
  |             ]]>
  |          </xsd:documentation>
  |       </xsd:annotation>
  |       <xsd:simpleContent>
  |          <xsd:extension base="xsd:string">
  |             <xsd:attribute name="class" type="classNameType" use="optional"/>
  |             <xsd:attribute name="replace" type="xsd:boolean"/>
  |          </xsd:extension>
  |       </xsd:simpleContent>
  |    </xsd:complexType>
  | 

Then you need a characters handler like 
org.jboss.kernel.plugins.deployment.xml.AnnotationCharactersHandler


  |       TypeBinding annotationType = schemaBinding.getType(annotationTypeQName);
  | 
  |        ...
  | 
  |       // annotation can take characters
  |       annotationType.setSimpleType(AnnotationCharactersHandler.HANDLER);
  | 

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

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



More information about the jboss-dev-forums mailing list