I have two XSD files with common elements and complex types. These XSD were generated by Maximo. How can I merge/flatten the XSDs into one?
The same namespace has been used in both XSDs.
I have two XSD files with common elements and complex types. These XSD were generated by Maximo. How can I merge/flatten the XSDs into one?
The same namespace has been used in both XSDs.
No easy answer, but if the schema documents are sufficiently large then you could invest in some XSLT tooling to reduce the amount of effort.
(a) use xsl:for-each-group to identify top-level components of the same kind and name across both files, e.g. two complexTypes with the same name.
(b) if there's only one element in the group, output it.
(c) if there are two elements in the group, use the deep-equals() function to compare them. If they are deep-equal, then just output the first. Otherwise, output both, together with a TODO comment that flags them for human intervention.
(d) reconcile the conflicts by hand.
If necessary, you could do some "normalization" before the deep-equals() comparison, e.g. stripping whitespace text nodes and xs:annotation elements.
Try to avoid, or minimize, the problem upstream during XSD generation. Maximo is configurable:
If you set the
mxe.int.resolveschema
global property totrue
in the System Properties application, all include files are resolved.
Source: IBM Maximo Asset Management Multitenancy : Schema generation
I do not know for certain, but if all included files are resolved means that the including XSD is flattened, then perhaps this could help you.