Comparing XML generated by SmartPlant Foundation’s Export Data command can be a pain, as the XML comes out in what seems to be random order.
- Exported objects (XML elements) are in random order
- Interfaces in those elements are in random order
- Properties (XML attributes) in those interfaces are in random order
I have a solution. 🙂
- Download Beyond Compare – the best general-pupose compare tool
- Download my custom Beyond Compare File Type for SPF XML comparisons
You will have to un-zip this file, then follow the Beyond Compare instructions for importing a *.bcpkg file. They also have more on their web site.
A Beyond Compare “File Type” is sort of a filter that modifies the XML on-screen so it can be compared more meaningfully. It does not modify your original files – unless you make changes in BC and save it.
Once you import this File Type it will default to assuming any *.xml file is an SPF export file, and it will sort and tidy the XML to make it compare more meaningfully.
- It sorts all exported objects by the ClassDef (XML element name)
- It sorts all the interfaces inside each object by the interface name
- It sorts all the attributes inside each interface
- If there are multiple objects with the same ClassDef (e.g. multiple <Rel> or <SPXEngineeringDocRevision> elements in your export) then it will sub-sort those based on their UID.
So now you can more easily identify what data changes resulted from a method by:
- Right-mouse click an object, select Export Data, save to a “before” file
- Make some change to the object
- Again right-mouse click the object, select Export Data, save to an “after” file
- Open Beyond Compare to compare the two files
- In the File Type dropdown at the top of the Text Compare windows, select “SPF XML Sorted And Tidied” (do both sides)
Voila! All changes are highlighted in red. 🙂
Enjoy!