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

refactor(common): Consider moving from xml2js to fast-xml-parser #12208

Closed
mcdurdin opened this issue Aug 16, 2024 · 2 comments · Fixed by #12502
Closed

refactor(common): Consider moving from xml2js to fast-xml-parser #12208

mcdurdin opened this issue Aug 16, 2024 · 2 comments · Fixed by #12502
Assignees
Milestone

Comments

@mcdurdin
Copy link
Member

mcdurdin commented Aug 16, 2024

Consider moving from xml2js to https://www.npmjs.com/package/fast-xml-parser?

Originally posted by @mcdurdin in #8616 (comment)

This arose again in discussions on kmc-convert

@srl295 we should discuss

@srl295
Copy link
Member

srl295 commented Aug 19, 2024

FWIW I use fast-xml-parser in https://github.com/unicode-org/cldr/tree/main/docs/charts/keyboards for those charts. But this is a simplistic use that is not attempting to validate.

Our json validation is separate from the xml validation, though, so that should not be an impact.
I'm sure there will be some bumps due to differences in handling.

fast-xml-parser is at least currently maintained!

srl295 added a commit that referenced this issue Aug 30, 2024
@darcywong00 darcywong00 modified the milestones: A18S9, A18S10 Aug 31, 2024
srl295 added a commit that referenced this issue Aug 31, 2024
srl295 added a commit that referenced this issue Aug 31, 2024
srl295 added a commit that referenced this issue Sep 1, 2024
srl295 added a commit that referenced this issue Sep 6, 2024
srl295 added a commit that referenced this issue Sep 6, 2024
srl295 added a commit that referenced this issue Sep 9, 2024
- need to use trimValues:false and a custom tagValueProcessor to preserve spaces

Fixes: #12208
srl295 added a commit that referenced this issue Sep 10, 2024
- difference in fast-xml-parser and xml2js handling here
- part of the move to fast-xml-parser

Fixes: #12208
srl295 added a commit that referenced this issue Sep 12, 2024
srl295 added a commit that referenced this issue Sep 12, 2024
turns out we didn't have a test for XML NCR in keyboards. Now we do.

Fixes: #12208
@darcywong00 darcywong00 modified the milestones: A18S10, A18S11 Sep 14, 2024
srl295 added a commit that referenced this issue Sep 27, 2024
srl295 added a commit that referenced this issue Sep 27, 2024
srl295 added a commit that referenced this issue Sep 27, 2024
srl295 added a commit that referenced this issue Sep 27, 2024
- help make the parsed form identical across platforms

Fixes: #12208
srl295 added a commit that referenced this issue Sep 27, 2024
Subsystems changed:
- ldml keyboard reader (main and test)
- kpj
- kvks
- kmp compiler

test: made the test-xml-utils less verbose about the pathnames

Fixes: #12208
srl295 added a commit that referenced this issue Sep 27, 2024
srl295 added a commit that referenced this issue Sep 27, 2024
srl295 added a commit that referenced this issue Sep 27, 2024
srl295 added a commit that referenced this issue Sep 27, 2024
@darcywong00 darcywong00 modified the milestones: A18S11, A18S12 Sep 28, 2024
srl295 added a commit that referenced this issue Sep 30, 2024
srl295 added a commit that referenced this issue Sep 30, 2024
- declarative syntax for options
- workaround an issue where xml2js is mutating our options objects
- improve tests

Fixes: #12208
srl295 added a commit that referenced this issue Sep 30, 2024
srl295 added a commit that referenced this issue Sep 30, 2024
srl295 added a commit that referenced this issue Sep 30, 2024
- writer passes kvks tests
- two small changes: allow " for XML generation, and also the same XML prologue as the actual .kvks files.

Fixes: #12208
srl295 added a commit that referenced this issue Sep 30, 2024
srl295 added a commit that referenced this issue Oct 2, 2024
srl295 added a commit that referenced this issue Oct 2, 2024
srl295 added a commit that referenced this issue Oct 2, 2024
@srl295 srl295 closed this as completed in 7e631c1 Oct 3, 2024
@github-project-automation github-project-automation bot moved this to Done in Keyman Oct 3, 2024
@srl295 srl295 reopened this Oct 3, 2024
@srl295
Copy link
Member

srl295 commented Oct 3, 2024

I had split the PRs so that this isn't actually fixed, yet.

srl295 added a commit that referenced this issue Oct 3, 2024
- because of the form to="" in ldml, we need to distinguish attributes and sub-elements in the ldml xml parsing
- use an attributePrefix, and fixup the object tree afterwards

Fixes: #12208
@srl295 srl295 closed this as completed in 3e168aa Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment