Giter VIP home page Giter VIP logo

Comments (3)

pdvrieze avatar pdvrieze commented on May 25, 2024

It should be enough to use @XmlElement(false) on the type attribute. If that doesn't work it is a bug in the default policy (making your own policy could fix that). Unfortunately changing the default for enums would be a problem at this point as it would break existing code/serial formats.

from xmlutil.

zelitomas avatar zelitomas commented on May 25, 2024

Thanks for your help! @XmlElement(false) really did help. Speaking of policies - is there any place (documentation perhaps) where I can learn about how to write / modify these?

Thank you once again for the @XmlElement(false)

from xmlutil.

pdvrieze avatar pdvrieze commented on May 25, 2024

As I'm primarily a full-time academic the documentation is somewhat limited. The policy is basically an interface that can be assigned in the configuration (when creating an XML object). There is a default implementation (DefaultXmlSerializationPolicy) that itself is somewhat configurable but can be overridden for specific behaviour. There is an example that mimics the Jackson strategy.

The concept is that rather than deciding how to serialize/structure things this is done by asking the policy. Important to consider here is that the serialization/deserialization works in two stages. First a tree of XmlDescriptors is created that will guide the serialization/deserialization. It is at this stage that the "structure" of the document is decided based on the policy. This structure is then used to actually serialize/deserialize. (the reason for this approach is to ensure consistency and reduce complexity in the encoder/decoders).

Many of the functions in the policy will give you access to (partial) descriptors and "parent" information. This is somewhat restricted as this is done during the building of the tree, so recursion issues must be avoided (eg. looking up the resolved children of a tag while deciding one of these children - you will have access to the underlying SerialDescriptor - just not the augmented descriptor).

from xmlutil.

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.