Comments (3)
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.
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.
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)
- Is it possible to completely ignore namespaces during deserialization? HOT 2
- Default namespace on root element and unqualified child elements HOT 5
- IndexOutOfBoundsException: There are no children HOT 3
- Support for multiple alternative names during parsing? HOT 2
- Error when integrated into android (java) application HOT 2
- Add Multiple NameSpaces for a XML Element HOT 4
- XML NameSpace Prefix is incorrect for Non-Null Attribute HOT 2
- XmlUtil.xmlCollapseWhitespace() throws StringIndexOutOfBoundsException on empty attribute HOT 2
- @XmlClassDiscriminator HOT 1
- Boolean decoding should be strict by default, or at least optionally HOT 4
- DefaultXmlSerializationPolicy deprecated constructor HOT 10
- Partial regression on checking root tag name checking HOT 4
- Wrong order of contents and string parsing HOT 5
- Comments in XML will cause native DOM parser to fail HOT 2
- XmlOtherAttributes: deserialization replaces keys by its value HOT 4
- Add version supporting serialization 1.5.1 but keeping kotlin as 1.8.10 HOT 1
- How to simply parse/serialize a Map to/from XML that has keys as tag names wrapping text values. HOT 5
- Using namespace HOT 2
- UnknownXmlFieldException parsing openlyrics when namespace is specified HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xmlutil.