Hi,

I'm quite new to JiBX and trying to implement SOAP client with JiBX, 
Spring WS and Axis2.

Anyway, cutting the long story short, I have to parse the following XML 
fragment:
<?xml version="1.0"?>
<cai3g:Cai3gFault xmlns:cai3g="http://schemas.company.com/cai3g";>
   <cai3g:faultcode>3004</cai3g:faultcode>
   <cai3g:faultreason>
     <cai3g:reasonText>Invalid User ID or password</cai3g:reasonText>
   </cai3g:faultreason>
   <cai3g:faultrole>Invalid User ID or password (role)</cai3g:faultrole>
   <cai3g:details>
     <detail>Invalid details</detail>
   </cai3g:details>
</cai3g:Cai3gFault>

Otherwise this is easy, expect for the fact that <cai3g:details> element 
contains another element that is in the default namespace (no namespace).

How can I handle such a thing with JiBX? I have the following binding:
<?xml version="1.0" encoding="UTF-8"?>
<binding xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:noNamespaceSchemaLocation="binding.xsd"
        value-style="element">

        <namespace uri="http://schemas.company.com/cai3g"; prefix="cai3g" 
default="all"/>

        <mapping name="Cai3gFault" 
class="com.company.cai3g.client.ProvisioningFailedException"
                        
factory="com.company.cai3g.client.model.ModelFactory.fault" 
ordered="false" flexible="true">
                <value name="faultcode" field="code"/>
                <structure name="faultreason" usage="optional">
                        <value name="reasonText" field="reason"/>
                </structure>
                <value name="faultrole" field="role" usage="optional"/>
                <!-- TODO figure out how to get also details -->
        </mapping>

</binding>

Everything else works, except for the details parsing part (I have a 
"details" field on the exception).

If I use
                <structure name="details" usage="optional">
                        <value name="detail" field="details"/>
                </structure>
then JiBX expects <detail> element also to be in CAI3G namespace 
(correctly).

I also tried to use
                <structure name="details" usage="optional">
                        <value name="detail" field="details" ns=""/>
                </structure>
but still JiBX expects <detail> element to be in CAI3G namespace.

Is there some way I can instruct JiBX to use no namespace, even if 
default namespace has been defined at root level in binding.xml?

Or maybe there is some way I can tell to JiBX: ignore all XML elements 
and just collect all text from this node and child nodes and put it in 
some field (of type String)?

Rgds,
Neeme


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to