jonas-grgt / xjx Goto Github PK
View Code? Open in Web Editor NEWLightweight XML Serializationg and Deserialization library for Java
License: Apache License 2.0
Lightweight XML Serializationg and Deserialization library for Java
License: Apache License 2.0
When releasing the github-tagger tags the repo based upon the last commit the github action has been triggered from.
This is not correct as during the run in the bump version step a new commit has been added. Which is not seen by the github-tagger although the previous step (checkout) check out the correct commit (inlcuding the bumped version).
When a value cannot be mapped to an enum it is defaulted to null.
Make this configurable.
When setting fields using reflection (ie. in FieldReflector
) check if the fields is accessible first, if not make it accessible and afterwards set the accessibility back to the default value.
Currently in TypeMappers
the default .parse
methods are used to parse the String to a date and/or time object.
Make this configurable on a global parser level.
Currently the default indentation is 2 spaces this should be made configurable
It's currently only possible to serialize a POJO to a String
. Add support for serializing a POJO to a File
.
Currently the default behavior is to pretty print all outputted XML. To save space make this configurable and if enabled remove all unnecessary white space.
The current implementation serializes null fields as an empty self-closed tag <Tag/>
Make this behavior configurable, by not including the tag if it's field contains null. Exception to this rule would be when the tag does contain a attribute then it should be included in the serialized document <Tag attribute="123"/>
I'm having issues parsing an XML file with this structure
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<foo name="A"/>
<foo name="B"/>
<bar name="X">
<info val="InfoValX1"/>
<info val="InfoValX2"/>
</bar>
<bar name="Z">
<info val="InfoValZ1"/>
</bar>
</manifest>
I set up a JUnit test too to reproduce the issue
public class XjXTests {
@Test
void testMultipleListsDeserialization() {
String data = """
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<foo name="A"/>
<foo name="B"/>
<bar name="X">
<info val="InfoValX1"/>
<info val="InfoValX2"/>
</bar>
<bar name="Z">
<info val="InfoValZ1"/>
</bar>
</manifest>
""";
XjxSerdes xjx = new XjxSerdes();
Manifest manifest = xjx.read(data, Manifest.class);
System.out.println(manifest.foos);
System.out.println(manifest.bars);
assertNotNull(manifest.foos);
assertNotNull(manifest.bars);
}
private static class Manifest {
@Tag(path = "/manifest", items = "foo")
private List<Foo> foos;
@Tag(path = "/manifest", items = "bar")
private List<Bar> bars;
}
private static class Foo {
@Tag(path = "/manifest/foo", attribute = "name")
private String name;
}
private static class Bar {
@Tag(path = "/manifest/bar", attribute = "name")
private String name;
@Tag(path = "/manifest/bar", items = "info")
private List<Info> infos;
}
private static class Info {
@Tag(path = "/manifest/bar/info", attribute = "val")
private String val;
}
}
There are actually two issues.
foos
List is null
. This is because of the bug (?), I believe XJX fails at parsing multiple collections on the same levelbars
List is empty, but this is probably an error on my side on defining the model classes. Sorry, it's my first day using your library, and I'm trying to figure out how it works, what it can doA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.