FasterXML / FasterXML/jackson-dataformat-xml

Allow preserving "is-attribute" with JsonNode to write output as attribute value

Aperta
#217 2 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
631
Fork
246
Merge medio
7g 9h
PR unite (30g)
13

Descrizione

I want to map a JsonNode to a XML. If I directly call XmlMapper write methods, this converts all the SubNode's of JsonNode as XMLElement which is fine.

But I want one of the field/subfield convert as XMLAttribute.

Is there a way to tell the mapper 'this node is not element, please convert it as attribute?'

Check the **_**OrgnlIntrBkSttlmAmt**_** field below (XML and json format is not preserved, sorry for that)

A sample JSON file is as follows :

```json
{
"FIToFIPmtCxlReq": {
"Undrlyg": [
{
"TxInf": [
{
"CxlId": "3EfXiRbNk517MHY",
"OrgnlInstrId": "0amcNeP5QhXnY9x3Ykkj5TScqoTQF",
"OrgnlIntrBkSttlmAmt": {
"Ccy": "EUR",
"Value": 1462216
}
}
]
}
]
}
}
```

The converted XML is as follows

```xml




3EfXiRbNk517MHY
0amcNeP5QhXnY9x3Ykkj5TScqoTQF
yy

EUR
1462216



```

The requested output is as follows:

```xml




3EfXiRbNk517MHY
0amcNeP5QhXnY9x3Ykkj5TScqoTQF
yy
1462216


```

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.