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