Skip to content

too strict attributes validation #5

@rlidwka

Description

@rlidwka

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', new String('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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions