BoM handler#

The BoM handler provides the serialization and deserialization of BillOfMaterial objects to and from XML format. This process validates that the BoM has a valid structure, and that the XML provided is syntactically correct.

class BoMHandler#

Handler for XML formatted BoMs, supports reading from files and strings, and serializing to string format.

Added in version 2.0.

load_bom_from_file(file_path)#

Read a BoM from a file and return the corresponding BillOfMaterials object for use.

Parameters:
file_pathPath

Location of the BoM XML file.

Returns:
BillOfMaterials
load_bom_from_text(bom_text)#

Read a BoM from a string and return the corresponding BillOfMaterials object for use.

Parameters:
bom_textstr

String object containing an XML representation of a BoM.

Returns:
BillOfMaterials
dump_bom(bom)#

Convert a BillOfMaterials object into a string XML representation.

Parameters:
bomBillOfMaterials
Returns:
str

Serialized representation of the BoM.