Open ancorcruz opened 5 years ago
@sshaw Do you have any ideas on how to tackle this issue?
Hi, invalid XML. No good. Though after all this time this makes me think that no one is validating.
Anyways, this is an issue with ROXML but, adding this to DDEX::Element
may fix things:
def self.roxml_attrs
super.reverse
end
def roxml_references
super.reverse
end
Let me know if that works for you. If so, I will create a release with it and open an issue or PR in ROXML.
I have been using the gem for parsing and processing the DDEX ERN/ECHO files for a while. However, I'm half way with XML files creation for the outbound feed now and found this issue. Are you writing DDEX XML files with the gem?
Your suggested change flips the order of everything, it might require some tweaking. I'll check with the aggregator if they accepts the generated XML as valid before further investigation.
Thanks.
ERN v3.2 XSD defines XML sequences for some elements (enforcing order of elements), I bet later versions of the standard do it as well.
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 inherit from other classes that define xml_accessors like:
XML elements defined in the parent classes are written in the XML output after the elements defined in the child class, however this is not what the XSD defines.
I'm not quite sure how to fix this issue. The only idea I have right now is define each XML element in a single class without inheritance from other XML elements. Not an small change.