Git Product home page Git Product logo

Comments (4)

arakelian avatar arakelian commented on July 27, 2024 1

For people who stumble upon this issue, see the Gist provided in #205 for a work around.

from jackson-dataformat-xml.

cowtowncoder avatar cowtowncoder commented on July 27, 2024

Correct, this problem does result from impedance between XML and JSON.
Another question is whether wrappers for elements were supported: I think structure that works is one without elements; and there is a known issue wrt handling of wrapper vs unwrapped lists.

But Map is pretty specific type, so I wonder if it might be possible to add bit more interaction to make it work.
The way Lists are handled does in fact rely on a somewhat specific low-level method, so it might be possible to add something similar for cases where Map-type content is expected.

from jackson-dataformat-xml.

cowtowncoder avatar cowtowncoder commented on July 27, 2024

I am not sure there is generic solution to this problem: your solution assumes that we can use heuristic to combine sub-trees, but this would not be guaranteed for all kinds of structures.

But it could work for some subset of cases; so question then is whether to try to work on something that would work with the standard Map deserializer (which is not format specific), or to add XML-specific Map deserializer.
Latter might make more sense, given that this is "impossible" case for JSON (and in fact I would argue should probably throw an exception so that users do not rely on being able to handle duplicates).

As to XML: there is the immediate problem wherein value of duplicate property may well be something other than another Map; so it is not clear what would be the proper way to merge things. For example:

<data>
  <r>A</r>
  <r><b>B</b><c>C</c></r>
</data>

would not quite work, as value for entry "r" would be String "A". So what should be done for the following entry?

from jackson-dataformat-xml.

cowtowncoder avatar cowtowncoder commented on July 27, 2024

I think the answer here is "works as designed" -- 'untyped' binding to Maps and Lists will not be working correctly without assuming more advanced rules, and I don't want to move to that direction.
Will close the issue as 'wont fix'.

from jackson-dataformat-xml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.