question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tag with attributes not working

See original GitHub issue

I 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:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
HarriAlasicommented, Oct 1, 2021

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)

0reactions
HarriAlasicommented, Oct 1, 2021

Either way, thank you and closing this out

Read more comments on GitHub >

github_iconTop Results From Across the Web

Html input attributes not working - Stack Overflow
Html input attributes not working - Stack Overflow. Stack Overflow for Teams – Start collaborating and sharing organizational knowledge.
Read more >
Block attributes do not display as expected in AutoCAD
Causes: Attribute display is turned off. The affected attributes are invisible. The block is redefined. The block was inserted as an external ...
Read more >
Why does my href attribute not work: | Codecademy
Hi i think it is becuase you used aprostophe on you code <a href='https://twitter.com/codecademy'> instead of quotation marks. so the code should be...
Read more >
Using data attributes - Learn web development | MDN
Issues. Do not store content that should be visible and accessible in data attributes, because assistive technology may not access them. In ...
Read more >
Attributes and properties - The Modern JavaScript Tutorial
For instance, if the tag is <body id="page"> , then the DOM object has body.id="page" . But the attribute-property mapping is not one-to-one!...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found