[ 
https://issues.apache.org/jira/browse/CXF-5072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13678400#comment-13678400
 ] 

Tom Stark commented on CXF-5072:
--------------------------------

If I fully-qualify each member then it will work both directions but this was 
what I was trying to avoid.

If I understand your last comment -- what you are saying is that it may not be 
possible to have the namespace change dynamically assuming an object is a 
composite and not just holding primitives.  However, (and this is going half 
way), could it default to the first namespace specified and use that for any 
unqualified elements while other elements remain fully-qualified?  Could this 
work?

{"user.user":{"user-role.user-role":{"user-role.name":"admin"},"username":"fred","first-name":"Fred",
 "last-name":"Person"}}"

Default namespace of "user" with composite objects fully-qualified.  
Unqualified elements default to the top-level namespace.
                
> Add capability in Jettison to default the namespace
> ---------------------------------------------------
>
>                 Key: CXF-5072
>                 URL: https://issues.apache.org/jira/browse/CXF-5072
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS, JAXB Databinding
>    Affects Versions: 2.5.2
>            Reporter: Tom Stark
>         Attachments: apache-cxf-issue.zip
>
>
> When using Jettison, it would be preferable to configure Jettison to allow 
> for the namespace to be the same as what was last used.  For example, 
> attached is a simple user object that has a long namespace name.  I can use 
> Jettison to alias the namespace to something shorter but I still need to 
> fully-qualify all members of the user object in JSON for Jettison to properly 
> marshal all of the fields to the java object.
> For example:
> {"user.user":{"user-role.user-role":{"user-role.name":"admin"},"user.username":"fred","user.first-name":"Fred",
>  "user.last-name":"Person"}}
> What is preferable is:
> {"user.user":{"user-role.user-role":{"name":"admin"},"username":"fred","first-name":"Fred",
>  "last-name":"Person"}}
> In this case, the beginning of a new namespace is used for objects that need 
> it.  After the object is defined, the namespace reverts to the previous 
> namespace.
> Output is fine since the "ignoreNamespace" strips all namespaces and the 
> resulting JSON is:
> {"user":{"user-role":{"name":"admin"},"username":"fred","first-name":"Fred","last-name":"Person"}}
> Note that the attachments have been edited to remove proprietary information 
> and probably will not compile by themselves.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to