relaxng / jing-trang

Schema validation and conversion based on RELAX NG
http://www.thaiopensource.com/relaxng/
Other
228 stars 69 forks source link

Feature Request: XML input module generate Schema attributes in same order as input file #253

Open bevanweiss opened 4 years ago

bevanweiss commented 4 years ago

Hi, I'm currently attempting to generate a toolkit to work with some proprietary software which can export files in an XML format. No public schema has been released for it however.

Whilst the software is XML compliant, and doesn't care about the ordering of attributes / elements (unless explicitly ordered), when attempting to perform diffs between files generated by the proprietary software package and my own toolkit it would be nicest if the entries were in the same order.

It appears that attributes within the output schema are currently sorted alphabetically.

Regards, Bevan Weiss

bevanweiss commented 4 years ago

So I found the change required. I'm just unsure what the current purpose of it is, I was expecting that it was going to perform pair-wise comparisons between elements to confirm they were 'equivalent', but as far as I can tell this done in a different fashion. So line 322 of mod/convert-from-xml/src/main/com/thaiopensource/relaxng/input/xml/Inferrer.java is where the sort takes place, removing this appears to have done the job for my requirement right now. Without passing an option all the way through to selectively sort / not sort I can't see a nice way to expose this via command line.