Hi Panduga, The problem in your binding is that you're making the http://www.fpml.org/2005/FpML-4-2 namespace the default for all elements (with default="element"). Take off the default="element" and instead specify the namespace individually for each element that uses one, with the ns attribute (so use ns="http://www.fpml.org/2005/FpML-4-2" on the <mapping> definition for FpML, for instance).
If you're working with a large number of elements using different namespaces you can also split your definition into multiple bindings, each one using a different default namespace - but that's a little more difficult to explain, so the ns="..." approach is probably where you should start. - Dennis Dennis M. Sosnoski SOA and Web Services in Java Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Panduga Pavan wrote: > I am new to jibx. I'm running into a problem while unmarshalling an > xml message. I've been trying various different ways, but to no avail. > I thought some experienced users of Jibx might guide me in the right > direction. > > The xml contains multiple namesapces, this does not seem to be a > problem. However, the usage of namespaces on the elements is not > consistent. for example one element uses a namespace while the other > does not. > > In my search in the archives of this mailing lists, it was mentioned > that if this is the case, the un marshalling does not work right out > of the box. we have to user custom unmarshalling. I would very much > like to take up the task if that's the only option I have, but if > there's any other way of achieving this without going down that path I > would very much appreciate if someone points me in the right direction. > > Here's a sample mapping and a sample xml that I've been working with. > > <binding> > <namespace prefix="xsi" > uri="http://www.w3.org/2001/XMLSchema-instance > <http://www.w3.org/2001/XMLSchema-instance>"/> > <namespace prefix="ibml" uri="http://www.ibml.jpmorgan.com/2005"/> > <namespace prefix="ns" uri=" > http://www.fpml.org/2005/FpML-4-2" default="elements"/> > <mapping name="FpML" class="com.organ.server.ibml.jibx.FpML"> > <value style="attribute" name="version" field="version"/> > <value style="attribute" name="ibmlVersion" field="ibmlversion"/> > <value style="attribute" ns=" > http://www.w3.org/2001/XMLSchema-instance" name="schemaLocation" > field="xsiSchemaLocation"/> > <value style="attribute" ns=" > http://www.w3.org/2001/XMLSchema-instance" name="type" field="xsiType"/> > </mapping> > <mapping name="header" class="com.organ.server.ibml.jibx.JibxHeader" > > <structure name="messageId" field="messageId" map-as="messageId"/> > <structure name="inReplyTo" field="messageId" > map-as="messageId"/> > <value name="sentBy" field="sentBy"/> > <value name="sentTo" field="sendTo"/> > <value name="creationTimestamp" field="creationTimestamp"/> > </mapping> > > <mapping class="com.organ.server.ibml.jibx.JibxId" > type-name="messageId" abstract="true"> > > The error I'm recieving > org.jibx.runtime.JiBXException : Expected > "{http://www.fpml.org/2005/FpML-4-2}FpML > <http://www.fpml.org/2005/FpML-4-2%7DFpML>" end tag, found > "{http://www.fpml.org/2005/FpML-4-2}header > <http://www.fpml.org/2005/FpML-4-2%7Dheader>" start tag (line 2, col 9) > > Thanks very much for your attention to this material, I'd very much > any help. > > Thanks. > pawons. > <value name="messageIdscheme" style="attribute" > field="messageIdscheme"/> > <value style="text" field="id"/> > </mapping> > <mapping name="response" > class="com.organ.server.ibml.jibx.JibxTradeResponse"> > <collection field="additionalData" factory=" > com.organ.server.ibml.jibx.JibxTradeResponse.createResponseDataList"> > <structure name="ibml:additionalData" > type="com.organ.server.ibml.jibx.JibxResponseData" > > <value style="attribute" > name="additionalDataScheme" field="additionalDataScheme"/> > <value name="ibml:additionalData" field="value"/> > </structure> > </collection> > </mapping> > </binding> > > > XML > ---------- > <FpML xmlns="http://www.fpml.org/2005/FpML-4-2" > xmlns:ibml="http://www.ibml.organ.com/2005 > <http://www.ibml.organ.com/2005>" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation=" > http://ibml.organ.com/2005../../xsd/IBML-1-1-6-EXP.xsd" > xsi:type="ibml:CreateTradeRequest" version="4-2" ibmlVersion="1-1"> > <header> > <messageId messageIdscheme=" > http://irfe.organ.com/coding-scheme/messageId">8765</messageId> > <inReplyTo messageIdscheme=" > http://app.organ.com/coding-scheme/messageId">YK1234DN</inReplyTo> > <sentBy></sentBy> > <sentTo>UAT</sentTo> > <creationTimestamp>2007-08-28 18:55:02</creationTimestamp> > </header> > <ibml:responseData> > <ibml:additionalData > additionalDataScheme="http://app.organ.com/coding-scheme/batch-number">YK1234</ibml:additionalData> > > <ibml:additionalData > additionalDataScheme="http://irfe.organ.com/coding-scheme/contract-number">123456</ibml:additionalData> > > <ibml:additionalData > additionalDataScheme="http://tss.organ.com/coding-scheme/contract-number/leg-1">1234566</ibml:additionalData> > > <ibml:additionalData > additionalDataScheme="http://irfe.organ.com/coding-scheme/trade-status-code">TF123456</ibml:additionalData> > > <ibml:additionalData > additionalDataScheme="http://irfe.organ.com/coding-scheme/trade-status-description">Messaging > transaction request accepted</ibml:additionalData> > </ibml:responseData> > </FpML> > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > 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 > ------------------------------------------------------------------------- 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