XML Transformations

Materials Compliance Management provides the capability of importing XML BOM files of formats other than the format native to Materials Compliance Management. For the import to work successfully, the foreign XML must first be converted into Materials Compliance Management XML. This section explains considerations about performing XML transformations for import into Materials Compliance Management.

This page discusses:

XSLT Mapping

Using XSLT, a one-time mapping needs to be performed between the schema representing the foreign XML and the Materials Compliance Management schema.

The result of applying the customized transform to an instance of foreign BOM data in its own XML format is a new document, which might be in Materials Compliance Management XML format, or any format that Materials Compliance Management already recognizes, such as legacy BOM format. It is recommended that your transforms should generate Materials Compliance Management XML, that is, XML that conforms to the Materials Compliance Management XML schema as defined in one of the XSD files, described in XSD for Importing XML:

  • MCC_BillOfMaterials.xsd
  • MCC_Elements.xsd
  • MCC_MaterialCompositionReport.xsd
  • MCC_PortalService.xsd
  • MCC_SimpleTypes.xsd
  • MCC_SubstanceThresholdReport.xsd
  • MCC_SupplierReport.xsd

These XSD files are included as part of the standard Materials Compliance Management installation. However, this feature will also support transformation to any format already recognized by Materials Compliance Management, such as IPC and Legacy BOM. In this case, two transformations will actually take place, first the customer's transform, for example, to a legacy BOM, and then another transformation (conversion) to Materials Compliance Management XML.

The transform must be pure XSL: no extensions will be supported. In particular, the XSL will have no access to an ENOVIA database context.

Once the .xsl file has been created and debugged, Materials Compliance Management must be told where to find the .xsl file using the following .properties file option:

emxMaterialsComplianceCentral.importer.XMLTransformFile

The value of this property must be set to the absolute path name of the .xsl file.

Note that only a single .xsl file can be referred to via this parameter. That file may "include" or "import" other XSL files, as supported by XSL. If you have more than one XML schema that you would like to be able to convert using this mechanism, you would need to include the combined set of rules in one transform.

To set the extension to be appended to the transformed file name, use this property:

emxMaterialComplianceCentral.importer.XSLTransformResultExtension

Values are "xml" (or leave unset) if the transform outputs XML or "txt" if the transform outputs to legacy BOM format.

Converter JPO

If, by itself, the capability of XSLT is not sufficient, or not convenient, for transforming a foreign XML format to Materials Compliance Management format, a JPO can be written to implement the transformation.

The JPO jpo.materialscompliance.importer.converter.Converter is a base program from which specialized converters for various import types (for example, IPC and legacy BOM) are derived. In this program, the method getConverter(Context, File) must be customized to recognize the custom format and instantiate the specialized converter subclass for it.

The specialized Converter subclass must implement the doConvert(Context, Job, File) method to actually perform the conversion and return the converted File(s).

Loader JPO

It is also possible that a particular custom BOM format contains data that you want to import into Materials Compliance Management that cannot be represented with the straight Materials Compliance Management XML and that require minor additions to the XML format. For instance, a company’s BOM data may include some custom attributes unknown by out-of-the-box Materials Compliance Management. Simply adding those attributes somewhere in the transformed XML would not be sufficient, because the Materials Compliance Management XML loader would not know to look for them. Therefore, some Java customization would be required.

The architecture of the Materials Compliance Management importer makes this relatively easy to do. The JPO jpo.materialscompliance.importer.loader.Loader is a base program from which specialized loaders are derived. For example, there is one for ReportedBOM, one for SubstancesList, and so on. Most of the code and customization hooks for all these loaders is in the base Loader. One can look in the base Loader and extend/override as needed to handle custom attributes and even custom elements.