Open ancorcruz opened 5 years ago
I'm trying to add some specs that probe the issue and also port the patch (tested) to ROXML gem.
I'm trying to add some specs that probe the issue and also port the patch (tested) to ROXML gem.
Great thanks. Would be a good idea to add a spec that validates output against schema.
that is a really good idea.
Also, I'm going to try and replace test_xml
gem with equivalent-xml
as it has support to ensure the order of the entities in the document.
Fixes https://github.com/sshaw/ddex/issues/16
ERN v3.2 XSD defines XML sequences for some elements (enforces elements order).
DDEX.write
generates XML with the elements in the wrong order, for example:however, the valid XML is:
or
while the valid XML is:
The root of the issue is in classes that include ROXML and inherit from another class that also includes ROXML, both defining xml_accessors.
ROXML appends superclass
roxml_attrs
to the class in use ones, however, in order to build valid DDEX XML messages we need to list the superclass attributes before the ones on the child class (as far as I have been able to check, be aware, the specification is bloated).Please, check the classes for the previous XML examples:
As a solution to this issue, DDEX::Element overwrites ROXML module's class method
roxml_attrs
to prepend the superclass attributes instead.