Skip to content

Restore xml children order#442

Open
j3k0 wants to merge 5 commits into
Leonidas-from-XIV:masterfrom
j3k0:restore-xml-children-order
Open

Restore xml children order#442
j3k0 wants to merge 5 commits into
Leonidas-from-XIV:masterfrom
j3k0:restore-xml-children-order

Conversation

@j3k0

@j3k0 j3k0 commented Apr 7, 2018

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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

coveralls commented Apr 7, 2018

Copy link
Copy Markdown

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.

@protobi-pieter

Copy link
Copy Markdown

@j3k0 This is brilliant.

@dogusev

dogusev commented Jan 3, 2019

Copy link
Copy Markdown

@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