Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add equivalent of JAXB @XmlRootElement to specify name of root XML element #2

Closed
cowtowncoder opened this issue Jan 2, 2011 · 1 comment

Comments

@cowtowncoder
Copy link
Member

(note: re-creation of [http://jira.codehaus.org/browse/JACKSON-452] by Chris Winters)

JAXB allows you to override the name of the root element (using @XmlRootElement when generating XML. For example, rendering this class to XML:

@JsonIgnoreProperties( {"meal", "notMeal", "mealNameDisplay"} )
public class MealEvent...

Generates XML like this:

lunch ...

But I'd like the root element to be 'meal' instead of 'MealEvent'.

FWIW, I tried the wild guess using @JsonTypeName( "meal" ) as well – it had no effect.

In this discussion Tatu suggested the annotation @JacksonXmlRootName.

@cowtowncoder
Copy link
Member Author

Implemented: now there is @JacksonXmlRootElement (named similar to JAXB annotation, just with "Jackson" prefix to reduce confusion).

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant