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

Restore xml children order #442

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

j3k0
Copy link

@j3k0 j3k0 commented Apr 7, 2018

Continuation of #440

This PR uses $source to restore the original XML nodes order.

Quite a refactoring the Builder class. It is now a 2 steps process:

Step 1. Preprocessing

Convert "json" nodes to a unified format.

In this format, children are extracted as an array, then sorted by their position in the original XML document (if made available during parsing, using the sourcemap option).

Step 2. XML building

The code here has been simplified as special cases are handled at preprocessing stage. It build the XML.

Also makes sure source map doesn't show up in the exported XML

j3k0 added 5 commits April 6, 2018 19:13
Quite a refactoring the Builder class.

It is now a 2 steps process:

1. Preprocessing

Convert nodes to a unified format.
In this format, children are extracted as an array, then sorted
by their position in the original XML document (if made available
using the `sourcemap` option).

2. XML building

The code here has been simplified as special cases are handled at
processing stage. It build the XML.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 97.416% when pulling 96d459c on j3k0:restore-xml-children-order into e8540dc on Leonidas-from-XIV:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 97.416% when pulling 96d459c on j3k0:restore-xml-children-order into e8540dc on Leonidas-from-XIV:master.

@coveralls
Copy link

coveralls commented Apr 7, 2018

Coverage Status

Coverage decreased (-0.2%) to 97.416% when pulling 96d459c on j3k0:restore-xml-children-order into e8540dc on Leonidas-from-XIV:master.

@pietersv
Copy link

@j3k0 This is brilliant.

@dogusev
Copy link

dogusev commented Jan 3, 2019

@j3k0 Amazin PR, waiting for it to be merged.

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 this pull request may close these issues.

4 participants