A library for enhanced navigations for JAXB models. It consists of two parts: An xjc-plugin (compile time) and a runtime component.
This and other XML projects were migrated into https://github.com/4Soft-de/harness-model. Please update your project to use the new project and open Issues / PRs there.
- Typesafe Idref-Relations (also Idrefs). The type can be defined as an abstract type if required
- Typesafe Parent navigation (multiple parents are supported - at runtime of course only one can be set)
- Bi-directional typesafe navigations
- Id-Lookup Map as gimmick when loading an XML-File with this lib. The XML-Id is used as key.
The last point was the main driver for this project and has helped us a lot. Without it the customer project would not have been possible.
The get a better understanding of this lib please have a look at our blog post about it based on a real project. https://www.4soft.de/blog/2018/navigation-on-large-xml-structures/
It is possible to extend the xml-file to write with comments or processing instructions
final XMLWriter<Root> xmlWriter=new XMLWriter<>(Root.class);
final XMLMeta meta=new XMLMeta();
final Comments comments=new Comments();
meta.setComments(comments);
comments.put(root,"Comment");
final List<ProcessingInstruction> pis=new ArrayList<>();
pis.add(new ProcessingInstruction("pc","checksum=\"12345\""));
final ProcessingInstructions processingInstructions=new ProcessingInstructions();
processingInstructions.put(root,pis);
meta.setProcessingInstructions(processingInstructions);
try(final ByteArrayOutputStream byteOutputStream=new ByteArrayOutputStream()){
xmlWriter.write(root,meta,byteOutputStream);
}
There is one major limitation of this project - it can only be used in read-only usecases! Non of the data structure are updated (parent, back-navigation, id-lookup, etc).
Our builds are distributed to Maven Central.
Make sure to replace the VERSION
below with a real version as the one shown above!
<dependency>
<groupId>com.foursoft.jaxb.navext</groupId>
<artifactId>navext-xjc</artifactId>
<version>VERSION</version>
</dependency>
compile group: 'com.foursoft.jaxb.navext', name: 'navext-xjc', version: 'VERSION'
<dependency>
<groupId>com.foursoft.jaxb.navext</groupId>
<artifactId>navext-runtime</artifactId>
<version>VERSION</version>
</dependency>
compile group: 'com.foursoft.jaxb.navext', name: 'navext-runtime', version: 'VERSION'
We appreciate if you like to contribute to our project! Please make sure to base your branch off of our develop branch and create your PR into that same branch. We will reject any PRs not following that or if this is already worked on.
Please read our detailed Contribution Guidelines for more information, for example code style, formatter, etc.