Hello,
it is possible to achive this by using two abstract bindings:
abstract_mapping.xml:
<binding>
<mapping abstract="true" class="ClassCommon" type-name="commonClassA">
<namespace uri="http://ClassA_Namespace/" default="all"
prefix="ps" />
<structure name="prop" field="prop" />
</mapping>
<mapping abstract="true" class="ClassCommon" type-name="commonClassB">
<namespace uri="http://ClassB_Namespace/" default="all"
prefix="ps" />
<structure name="prop" field="prop" />
</mapping>
</binding>
classA_mapping.xml:
<binding>
<mapping name="classA" class="ClassA">
<namespace uri="http://ClassA_Namespace/" default="all"
prefix="ps" />
<structure name="prop" field="prop" map-as="commonClassA" />
</mapping>
</binding>
classB_mapping.xml:
<binding>
<mapping name="classB" class="ClassB">
<namespace uri="http://ClassB_Namespace/" default="all"
prefix="ps" />
<structure name="prop" field="prop" map-as="commonClassB" />
</mapping>
</binding>
regards,
Guido
On 8/10/07, Guido Wischrop <[EMAIL PROTECTED]> wrote:
> Hello,
> I have a problem (again) with a abstract mapping and namespace (prefixes).
> I have three classes ClassA, ClassB and ClassCommon.
> The classes ClassA and ClassB are using the ClassCommon:
>
> class ClassA {
> ClassCommon prop = new ClassCommon();
> ...
> }
>
> class ClassB {
> ClassCommon prop = new ClassCommon();
> ...
> }
>
> class ClassCommon {
> String prop = "test";
> ...
> }
>
> Now I need two bindings for ClassA and ClassB but with different namespaces:
>
> binding.xml:
> <binding>
> <include path="abstract_mapping.xml"/>
> <include path="classA_mapping.xml"/>
> <include path="classB_mapping.xml"/>
> </binding>
>
>
> classA_mapping.xml:
> <binding>
> <mapping name="classA" class="ClassA">
> <namespace uri="http://ClassA_Namespace/" default="all"
> prefix="ps" />
> <structure name="prop" field="prop" map-as="classCommon" />
> </mapping>
> </binding>
>
> classB_mapping.xml:
> <binding>
> <mapping name="classB" class="ClassB">
> <namespace uri="http://ClassB_Namespace/" default="all"
> prefix="ps" />
> <structure name="prop" field="prop" map-as="classCommon" />
> </mapping>
> </binding>
>
> abstract_mapping.xml:
> <binding>
> <mapping abstract="true" class="ClassCommon">
> <namespace default="all" prefix="ps" /> <!-- THIS WON'T WORK
> !!!! -->
> <structure name="prop" field="prop" />
> </mapping>
> </binding>
>
> The ClassCommon fields need to have the prefix "ps", but I don't know
> how to force jibx to set it.
>
> Can somebody help?
>
> Thanks,
> Guido
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users