tag with attributes not working
See original GitHub issueI am trying to generate
<Amt Ccy="EUR">158.4</Amt>
(as part of a larger SEPA payment xml)
Following the examples 4 and 7, I came up with
this.creditTransferTxXml.CdtTrfTxInf.Amt = {_attrs: {Ccy:SEPAInfo.payment.currency}, _content: SEPAInfo.payment.amount.toString()};
However, this produces
<Amt Ccy="EUR"><_content>158.4</_content><Amt>
I know the example #4 had only one tag, so I mixed it with example #7 and added a string instead of an object to the _content object.
I tried to do it with two steps(first add attribute, then add content), but couldn’t figure out that either
Tried it with name attrtibute as well:
this.creditTransferTxXml.CdtTrfTxInf.Amt = {_name: 'Amt', _attrs: {Ccy:SEPAInfo.payment.currency}, _content: SEPAInfo.payment.amount.toString()};
However, this produced what I want, and then an extra tag wrapped around it
<Amt><Amt Ccy="EUR">158.4</Amt></Amt>
Syntactically it tries to add and Amt element to existing Amt element. I’m just trying to modfy the existing one
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Indeed It is. Might I suggest updating the examples (maybe number 2, because array syntax is not needed only for duplicate keys, but also for multiple child nodes, which can very well be distinct.
I have re-read the examples and the only one this idea comes out on is example number 9 & 10 (and maybe 16 as well, although not mentioned directly)
Either way, thank you and closing this out