-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
XML parsing error when nested XML has element with unbound attribute #328
Comments
Thank you for reporting this, and including reproduction. Aside from that, the best way to debug as user is to first see what serialization is (create value, serialize as XML), compare to XML you are trying to bind. This won't always show the problem but can help with some structural impedance. |
@cowtowncoder Here is the code to reproduce without lombok.
|
Thank you for reproduction. I think that cases that seemingly work are probably accidentally omitting the attribute, but the core of problem is this: unless property implied by attribute is explicitly ignored (not just by default), its existence will trigger an exception because structurally only XML elements with single textual value (element text or attribute) may be bound to Put another way: anything for which more than one piece of information is found from XML MUST be a POJO with multiple properties. Only text-only or single-attribute only (and no text content) XML content may be bound/mapped to a String. Simplest way here, then, would be to explicitly ignore |
Is this by design? It seems like a limitation to only allow either 1 attribute or text content. I'm facing a case now where I would also need both. By the way, if I serialise it, it works perfect and shows both the attribute and the text content |
@boudewijnvanweert Is that question related to this issue? I am not sure how it relates; if not, please file a new issue. |
Test passes with 2.12.0; closing. |
I'm seeing a parsing error which seems to be a bug.
Using the following:
POJOs:
For
Inner
there is an attribute on theDate
element, namedscheduled
below, which I want to ignore.E.g.
If I deserialize into an instance of
Inner
, it works as expected. But whenInner
is nested inside another element, I get an error.E.g.
Produces this error:
I tried without using Lombok annotations and got the same result.
Full code to reproduce:
Output:
The text was updated successfully, but these errors were encountered: