javajaxbxmlbeans

JAXB Boolean Getter to Check for Existence of Node


I was trying to migrate a bulky piece of code from XMLBeans to JAXB. For the XMLBeans classes generated in the original code, there are a lot of isXXX() methods that are available to check for the existence of a XML tag. When I generated the JAXB classes no such methods were generated. I suspect there might be a way in JAXB to do it as well. I tried searching for a solution, but could not find an answer. I did redo a little bit of code migration by replacing the code with null checks instead. But it seems to be tedious. If there is a way to generate such methods, can you please let me know.


Solution

  • You can use the

    <jaxb:globalBindings generateIsSetMethod="true">
    

    binding to generate isSetXyz() methods.