FasterXML / FasterXML/jackson-dataformat-xml

Each list element is wrapped into an extra tag with the name of the list property (RFE: combine type id, property name)

Abierto
#230 15 comentarios 6 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Java
Estrellas
631
Forks
246
Merge medio
7 d 9 h
PR fusionados (30 d)
13

Descripción

I am implementing a Java class for calling an external API with uses XML as data format. The API provider provides for each Endpoint the corresponding XML schema. I used the XJC compiler to create schematically compliant Java classes.
Now I have the problem, that the object mapper does wrap list elements into extra tags and therefore, the API call is rejected.

**XML schema:**
```



...

...

```

**Java class:**
```
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"transactionAndErrorAndErrorEmail"
})
public static class Body {
@XmlElements({
@XmlElement(name = "transaction", type = Transaction.class),
@XmlElement(name = "error", type = Error.class),
@XmlElement(name = "errorEmail", type = String.class)
})
protected List transactionAndErrorAndErrorEmail;
...
}
```

**Object Mapper Configuration:**
```
final ObjectMapper objectMapper = Jackson2ObjectMapperBuilder
.xml()
.modules(new JaxbAnnotationModule())
.defaultUseWrapper(false)
.serializationInclusion(JsonInclude.Include.NON_NULL)
.build();
```

**Generated XML:**
```



...




...

```

**What I expected:**
```


...


...

```

I am working with Jackson version `2.8.8`, but I tested it also with version `2.9.0.pr2`, but without success.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.