Thanks Sergey. It looks like complex entities would require a lot of transforms however which would make this prohibitively expensive to maintain. I am using camel mediators so I am currently planning to regex substitute the namespace separator until you can work in your magic :-)
Along those lines however, we would love to be able to use a double underscore as a separator (__) rather than a single character. This will lessen the potential of conflicts with entity attribute names with odd characters (e.g. with a single underscore). Would this enhancement be possible or too painful to put into your patch? I can slide for a while using regex but its going to be very costly call for large payloads. Thanks! -Mike On Tue, Nov 18, 2014 at 9:14 AM, Sergey Beryozkin <[email protected]> wrote: > Hi > On 18/11/14 15:07, Lambert, Michael wrote: > >> | I'm planning to get Jettison 1.3.7 out in the end of the year or >> January, >> have no problems getting that minor improvement in and adapting the CXF >> provider accordingly. >> >> Amazing and thanks again Sergey! >> >> | you can configure Jettison to ensure that say a 'name' field gets >> qualified before it fed into the JAXB runtime >> >> Can you provide an example? I am not sure I understand how this is done. >> >> > See http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX- > RSDataBindings-CustomizingJAXBXMLandJSONinputandoutput, > an inTransformElements can be used to do something like > "*":"{myns}:*" > > I'm not 100% sure a wildcard works for the non-qualified names, if not then > "name":"{myns}:name" > would do for a start > > Thanks, Srrgey > > You need to be on my Christmas card list! >> >> -Mike >> >> >> On Tue, Nov 18, 2014 at 8:07 AM, Sergey Beryozkin <[email protected]> >> wrote: >> >> Hi Mike >>> On 18/11/14 13:05, Lambert, Michael wrote: >>> >>> Gentlefolk, >>>> >>>> Thanks for addressing us so nicely, despite facing the issue described >>>> >>> below :-) >>> >>> I am using CXF/Jettison to marshall/unmarshall XML objects to JSON using >>>> the "mapped" convention of mapping XML namespace to our JSON payloads. >>>> That >>>> convention, as you know, using a dot separator to prepend a namespace >>>> prefix onto entity attribute names: >>>> >>>> { "ns1.id" : 4, "ns2:name" : "mike" } >>>> >>>> Unfortunately we have discovered that using dot separators cases a >>>> problem >>>> with many Javascript frameworks as they reserve the use of dots for >>>> child/parent graph traversal (e.g. Ember) >>>> >>>> https://github.com/emberjs/ember.js/issues/9630#issuecomment-63423812 >>>> >>>> I see that a patch was submitted to Jettison which would allow me to >>>> substitute a different separator but it does not seem to have been >>>> accepted >>>> and their mailing list appears DOA. >>>> >>>> https://jira.codehaus.org/browse/JETTISON-139 >>>> >>>> I'm actually monitoring the list, but I did miss that JETTISON-139 was >>>> >>> offering this particular enhancement. >>> I'm planning to get Jettison 1.3.7 out in the end of the year or January, >>> have no problems getting that minor improvement in and adapting the CXF >>> provider accordingly. >>> >>> I also tried to use Jackson rather than Jettison to do XML to JSON >>> >>>> marshalling but there is so little documentation related to it I gave up >>>> (I >>>> couldnt figure out how to get XML objects that didnt have root element >>>> annotations to serialize after several hours) >>>> >>>> I seem to be stuck and this looks like it could potentially be a very >>>> common problem (as Ember is a popular javascript framework). Do I have >>>> any >>>> options? Has anyone run into this? >>>> >>>> Unless you plan to push the data back to the server, the best option is >>> simply get the namespaces ignored. If the data are pushed back to the >>> server then try dropping the namespaces anyway and experiment with >>> applying >>> a transformation feature to the incoming data, you can configure Jettison >>> to ensure that say a 'name' field gets qualified before it fed into the >>> JAXB runtime >>> >>> Cheers, Sergey >>> >>> >>>> Thanks! >>>> >>>> -Mike >>>> >>>> >>>> >>> >> > > -- > Sergey Beryozkin > > Talend Community Coders > http://coders.talend.com/ > > Blog: http://sberyozkin.blogspot.com >
