I don't understand exactly what you're trying to accomplish, Srivivas. If you have an existing XML format you need to use, JiBX should allow you to do so. Multiple namespaces can be handled, too - just use multiple <namespace> elements in the binding (but only one, at most, with default='elements' at a level). The non-default <namespaces> can be used for any <structure> or <value> name by just specifying an ns='URI' attribute on that <structure> or <value>.
If you're defining a format, it's generally best to only use one namespace, and use that namespace for all the elements you're defining but none of the attributes (basically the equivalent of elementFormDefault='qualified' in a schema definition). - 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 srinivas murthy wrote: > > Hi Srinivas, > > > The problem is that you're actually including a namespace prefix in the > > name you set on your <mapping>. This is not explicitly forbidden since > > there are some case where people might want to disable namespaces in > the > > parser and handle things directly, but it's not how you want to work > > with a <namespace> definition. Take off the prefixes from your element > > names and instead use a ns=" http://www.dnb.com/IDP/Request/Match/Vers1" > > attribute on the <mapping> element to tell JiBX the namespace you want > > to use - it'll set the prefix itself when marshalling. > > > - Dennis > > Dennis, > Thank you for the response. I have subsequently made changes in my > namespace > declaration as suggested. > Here's an excerpt from my bindings.. > > <binding> > <namespace uri=" > http://www.dnb.com/IDP/Common/Enumeration/Common/Vers1" > prefix="idp-enumcom" default="elements"/> > > <mapping name=" MatchRequest" > class="com.dnb.esbsearch.types.MatchRequestInfo"> > <namespace uri=" http://www.dnb.com/IDP/Request/Match/Vers1" > prefix="idp-matchreq" default="elements"/> > <structure > type="com.dnb.esbsearch.types.MatchSpecificationInfo" field="matchSpec"/> > <structure > type="com.dnb.esbsearch.types.MatchInventoryDataInfo" > field="matchInventoryData"/> > </mapping> > > <mapping class="com.dnb.esbsearch.types.MatchSpecificationInfo > " name="MatchSpecification"> > <namespace uri="http://www.dnb.com/IDP/Product/Match/Vers1" > prefix="idp-matchprod" default="elements"/> > <structure field="matchDataCriteria" > type="com.dnb.esbsearch.types.MatchDataCriteriaInfo"/> > <value name="MaxQuantity" field="maxQuantity"/> > <value name="ExactMatchIndicator" type="boolean" > field="exactMatchInd"/> > <structure > type="com.dnb.esbsearch.types.GeneralisedScopeInfo" > field="generalisedScope"/> > </mapping> > ... > </binding> > > Here's my sample input.. > <idp-matchreq:MatchRequest id="mr"> > <idp-matchprod: MatchSpecification> > <idp-enumtype:MatchDataCriteria> > <ipd-enummtchdata:NameAddressLookup contextRef="mr"/> > </idp-enumtype:MatchDataCriteria> > <idp-com:MaxQuantity contextRef="mr" > unitRef="mr">25</idp-com:MaxQuantity> > ... > </idp-matchreq> > > Problem is, my xml is entirely composed of elements where simple > attributes would have sufficed. > A structure included in one mapping block, could have multiple > namespaces. For instance, idp-matchprod > declared for MatchSpecification mapping block, would have a lone > element MaxQuantity, which would need > the prefix idp-com. > Once I use the default="elements" at the top level, I'm faced with the > prospect of having to suggest other namespaces > at value level, which is not possible. I have pondered the possibility > of using another abstract mapping to handle MaxQuantity, > but then that would result in another superficial tag that my request > cannot handle.. What am I missing here, please? > > Regards > Srinivas > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ------------------------------------------------------------------------ > > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users