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)

Aperta
#230 15 commenti 6 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
631
Fork
246
Merge medio
7g 9h
PR unite (30g)
13

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.