You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now this module expect attributes to be string primitives.
I'd expect numbers to be automatically converted to strings if necessary. There is also a common practice how to handle boolean and non-existent attributes (see below).
// this fails, expected: <element test="123">xml.startElement('element').writeAttribute('test',123)// this fails, expected: <element test="123">xml.startElement('element').writeAttribute('test',newString('123'))// this fails, expected: <element test="test">xml.startElement('element').writeAttribute('test',true)// this fails, expected: <element>xml.startElement('element').writeAttribute('test',false)// this fails, expected: <element>xml.startElement('element').writeAttribute('test',null)// this fails, expected: <element>xml.startElement('element').writeAttribute('test',undefined)
The text was updated successfully, but these errors were encountered:
added support for using numeric values in attributes and element text
added support for suppressing attribute if the value is false-y
xw.startElement('tag')
.writeAttribute('key1', false)
.writeAttribute('key2', null)
.writeAttribute('key3', undefined)
.text(3.14)
.endElement();
results in: <tag>3.14</tag>
(see Inist-CNRS#5)
Right now this module expect attributes to be string primitives.
I'd expect numbers to be automatically converted to strings if necessary. There is also a common practice how to handle boolean and non-existent attributes (see below).
The text was updated successfully, but these errors were encountered: