JiBX always uses namespaces, so there's no direct way to handle this. If the documents are consistent (in other words, they either use namespaces throughout or use the non-namespace version throughout) you can handle this with two separate binding definitions. A modified form of the org.jibx.extras.BindingSelector code could then look at the root element to determine whether to use the namespaced or non-namespaced binding.

If the documents mix the two forms you might still be able to do something with subclasses, though this would get ugly - you'd basically need to define subclasses of your sync4j.framework.core.SyncML and map them separately, one using namespaces and the other not. If the child elements of the SyncML element are always non-namespaced you can just use an abstract base mapping that handles all the details.

Hope these suggestions help,

- Dennis

Luigia Fassina wrote:

Hi,
How can I make JiBX ignoring a tag namespace?


In the binding.xml I have declared

<mapping name="SyncML" ns="syncml:syncml1.0" class="sync4j.framework.core.SyncML">
<structure field="header"/>
<structure field="body"/>
</mapping>


The problem is that not all the XML documents will explicity specify the namespace.

If the xml message has tag <SyncML> and not <SyncML xmlns="syncml:syncml1.0"> JiBX throws an Unmarshall Exception!!
I want that the tag <SyncML> is obligatory but not the declaration of namespace.


Thanks in advance
Luigia




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to