Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 3
    It solved the problem, Thanks! I used the second solution , @XmlRootElement(name="Group"). My class name is Group, and XML root element is Group, why I still need name="Group" Commented Mar 5, 2011 at 11:15
  • 1
    Check out: stackoverflow.com/questions/5203531/… Commented Mar 5, 2011 at 11:48
  • 2
    @BlaiseDoughan I'm having the exactly opposite problem, I have @XmlRootElement(name = "MB") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "MB", propOrder = { "date", "time" }) but i'm getting unexpected element (uri:"http://xx.title.com/new/response", local:"MB"). Expected elements are <{}Date>,<{}MB>,<{}Time> i also have @XmlElement(name="Date", required = true) over each field. Where & Why is it going wrong? I've also tried removing @XmlRootElement! Commented May 16, 2012 at 14:25
  • 6
    There was an issue with @XmlSchema in package-info.java, fixed now. Commented May 17, 2012 at 7:39
  • This answer is fully misslieading @Glenn Mason one is the good one I believe. Commented Mar 7, 2022 at 0:18