Comments (5)
I just learned that using
@Serializable data class Team(@XmlSerialName("members", "", "") val members: List<Person>, val colors: List<String> = listOf())
will produce the same output as Jackson. Thus, this is solved (with downside that I would have to repeat the parameter name). I still would like to get this w/o adding all the annotations.
from xmlutil.
The library was designed to provide a "natural" XML experience. In line with XML schema it is the type that provides the tag name, not the property of the tag. However, these are fundamentally choices. I would be open for pull requests that would make this behaviour configurable.
from xmlutil.
I've just released a version that uses a "policy" object to configure serialization. You may want to have a look at that. It would allow you to have a custom policy rather than using the annotations. Let me know if that works for you. I'll see at adding some more documentation for it as well. I may add a jackson compatibility policy to make it easier for people in your case. Btw. how does Jackson handle polymorphic values/lists?
from xmlutil.
I've added an example and documentation on how to use the policy to do this. Have a look: https://github.com/pdvrieze/xmlutil/blob/master/examples/JACKSON.md
It should solve your problem. I don't want to put this in the library proper as it isn't quite complete and may need a different approach for different cases.
from xmlutil.
Yes, that looks like a good approach. Thank you!
from xmlutil.
Related Issues (20)
- Enums as XML attributes HOT 3
- 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 2
- 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
- Value class causes wrong order during serialization HOT 3
- Include failed content when decoding HOT 3
- Deserializing object with variable XmlValue HOT 1
- Can't be used from pure Java code HOT 11
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.