Skip to content

Improve error if root tag contains invalid character #555

@Christilut

Description

@Christilut

Took me a while to figure this error out: Error: Invalid character in name which comes from the XmlBuilder.

Turns out this came from the fact that I accidentally did something like this:

builder.buildObject({ 
  $: {
    foo: 'bar'
  },
   ...
}

And the $ is assumed to be the attrKey but gives the above error when used on the root node.

I thought there was something wrong with the attrKey setting or some other bug.

So maybe a quick check can be added with a better error message so others don't fall into this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions