Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal character does not get sanitized. #105

Closed
sladage opened this issue Sep 15, 2021 · 0 comments · Fixed by #106
Closed

Illegal character does not get sanitized. #105

sladage opened this issue Sep 15, 2021 · 0 comments · Fixed by #106
Assignees
Labels
bug Something isn't working

Comments

@sladage
Copy link
Contributor

sladage commented Sep 15, 2021

The following code emits invalid xml:

import * as XB from 'xmlbuilder2'

const b = XB.create()
b.ele('doc').ele('test').txt('some & text; foo')
const xml = b.end()
console.log(xml)

expected:

<?xml version="1.0"?><doc><test>some &amp; text; foo</test></doc>

got

<?xml version="1.0"?><doc><test>some & text; foo</test></doc>

My guess is '& test;' gets recognized as an entity.

Version:

  • xmlbuilder2 3.0.2
@sladage sladage added the bug Something isn't working label Sep 15, 2021
sladage added a commit to sladage/xmlbuilder2 that referenced this issue Sep 15, 2021
Entitities do not contain spaces, changed regex accordingly.
oozcitak added a commit that referenced this issue Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants