Hi Jean-Michel,

Thanks for contributing this back! I'd looked at your problem and didn't
think of any easy workaround, so I'm glad you came up with one on your
own. :-)

  - Dennis

Dennis M. Sosnoski
Java SOA and Web Services Consulting <http://www.sosnoski.com/consult.html>
Axis2/CXF/Metro SOA and Web Services Training
<http://www.sosnoski.com/training.html>
Web Services Jump-Start <http://www.sosnoski.com/jumpstart.html>


On 01/27/2011 07:27 AM, Jean-Michel FRANCOIS wrote:
> I answer to my question, in case it can help someone else.
>
> The solution I've found is to use my own parser wrapper class.
> It looks like
> public class CustomXMLReader extends StAXReaderWrapper implements 
> IXMLReader {
>
>      public CustomXMLReader(XMLStreamReader rdr, String name, boolean nsa) {
>          super(rdr, name, nsa);
>      }
>
>      @Override
>      public String getNamespace(){
>          String ns = super.getNamespace();
>          if ( "".equals(ns)){
>              return "uri2";
>          }
>          return ns;
>      }
> }
>
> ( idea coming from this thread 
> http://www.mail-archive.com/jibx-users@lists.sourceforge.net/msg02726.html )
>
> Cheers
> Jean-Michel
>
>
> Le 20/01/2011 16:13, Jean-Michel FRANCOIS a écrit :
>   
>> Hi,
>>
>> I'm facing a problem with a web services provider that uses 
>> (incorrectly) 2 namespaces in its messages.
>> In a first service I receive something like
>> <a xmlns="uri1">
>> <b xmlns="uri2">
>> <c/>
>> </b>
>> </a>
>>
>> But in a second one I have
>> <aa xmlns="uri1">
>> <b xmlns=""> <!-- <= should be xmlns="uri2" -->
>> <c/>
>> </b>
>> </aa>
>>
>> b element is defined in namespace "uri2" in the schema thus codegen 
>> generates the correct binding.
>> Of course when parsing the second response Jibx complains about the 
>> unknown b element.
>> The problem comes from the ws provider's response, but there is no 
>> chance to see it being corrected.
>>
>> In xmlbeans, that I'm currently migrating from, I used a namespace 
>> substitution at parse time with
>>         Map<String, String> prefixes = new HashMap<String, String>();
>>         prefixes.put("", "uri2");
>>         XmlOptions.setLoadSubstituteNamespaces(prefixes);
>>
>> Does exist, in Jibx, something like setLoadSubstituteNamespaces ?
>>
>> If not, by which customization can I handle such a case ?
>>
>>
>> Thank you for your help
>> Jean-Michel
>>     
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
> February 28th, so secure your free ArcSight Logger TODAY! 
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>   
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to