[Design the new POJO MicroContainer] - Re: Getting content of XML element
by adrian@jboss.org
"kabir.khan(a)jboss.com" wrote :
| Also, for a similar schenario I will need to construct a org.w3c.dom.Element from the nested contents of a element. Is that possible?
|
It works with the annotation based parsing.
| public class ElementWildcard
| {
| private Element wildcard;
|
| public Element getWildcard()
| {
| return wildcard;
| }
|
| @XmlAnyElement(lax=true)
| public void setWildcard(Element wildcard)
| {
| this.wildcard = wildcard;
| }
| }
|
I couldn't get it to work properly with the old parser.
Why do you want to do this? This is usually horrible.
Is this the old XmlLoadable stuff?
You should remove this, and configure them using the MC as normal beans.
Then if somebody really wants to do this horrible thing you just do
| <property name='bad" type="org.w3c.dom.Element"><![CDATA[<xml-here/>]]></property>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106527#4106527
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106527
18 years, 4 months
[Design the new POJO MicroContainer] - Re: Getting content of XML element
by adrian@jboss.org
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
18 years, 4 months