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)

未關閉
#230 15 則留言 6 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Java
星號
631
分支
246
平均合併
7 天 9 小時
30 天內合併 PR
13

描述

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.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。