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

'>' are not escaped by the XmlSerializer #165

Open
sbaramov opened this issue Jun 11, 2020 · 1 comment · May be fixed by #177
Open

'>' are not escaped by the XmlSerializer #165

sbaramov opened this issue Jun 11, 2020 · 1 comment · May be fixed by #177

Comments

@sbaramov
Copy link

Currently the XmlSerializer does not escapes the '>' characters so a string like this:
<x id="START_ITALIC_TEXT" ctype="x-i" equiv-text="&lt;i&gt;"/>
becomes
<x id="START_ITALIC_TEXT" ctype="x-i" equiv-text="&lt;i>"/>

This could easily be fixed by changing line 164 and 168 to include the '>' character

this:
return buf.push(' ', attrNode.name, '="', attrNode.value.replace(/[<&"]/g, this._xmlEncoder), '"');
becomes:
return buf.push(' ', attrNode.name, '="', attrNode.value.replace(/[<>&"]/g, this._xmlEncoder), '"');

same with line 168:
return buf.push(textNode.data.replace(/[<&]/g, this._xmlEncoder));
becomes:
return buf.push(textNode.data.replace(/[<>&]/g, this._xmlEncoder));

Since the change is so small did not feel like creating a pull request. However if you prefer a pull request I will be glad to create one

@terencehonles terencehonles linked a pull request Dec 14, 2020 that will close this issue
@terencehonles
Copy link

It looks like this is not an oversight (and what I figured might be the case), but it looks like ">" "may" be escaped https://www.w3.org/TR/xml/#NT-AttValue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants