Xml file parse with jackson.dataformat.xml

Hi,

           JacksonXmlModule xmlModule = new JacksonXmlModule();
            xmlModule.setDefaultUseWrapper(false);
            ObjectMapper objectMapper = new XmlMapper(xmlModule);
            objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
            pojo = objectMapper.readValue(getXmlString(), definitions.class);

Example objects

@NoArgsConstructor
@AllArgsConstructor
@Data
public final class process
{
    public String id;
    public startEvent startEvent;
    public List<exclusiveGateway> exclusiveGateway;
    public List<sequenceFlow> sequenceFlow;
    public List<userTask> userTask;
    public endEvent endEvent;
    public boolean isExecutable;

}

I was able to parse the xml file, but There is only one element in the sequenceFlow, exclusiveGateway list. Has anyone parsed the xml that bpmn.io generates?`

Hi @kypdk ,

so if I get it correctly, you are trying to parse a BPMN XML with Jackson but experience issues doing that.

Has anyone parsed the xml that bpmn.io generates?`

bpmn.io generates OMG BPMN 2.0 compliant BPMN XML, so this parsing problem should not be related to bpmn.io, but more to the usage of Jackson I would assume.

Hence I would recommend that you reach out to the Jackson community for assistance (e.g., GitHub - FasterXML/jackson: Main Portal page for the Jackson project).

Thanks
Max

1 Like

Hi @kypdk,

there is a Model API that helps to read and write BPMN Models with Java: BPMN Model API | docs.camunda.org

Hope this helps, Ingo