@@ -44,9 +44,18 @@ as a ``str``.
4444
4545.. code-block :: python
4646
47- from cyclonedx.output import get_instance , BaseOutput, OutputFormat
47+ from cyclonedx.output import make_outputter , BaseOutput, OutputFormat, SchemaVersion
4848
49- outputter: BaseOutput = get_instance(bom = bom, output_format = OutputFormat.JSON )
49+ outputter: BaseOutput = make_outputter(bom = bom, output_format = OutputFormat.JSON , schema_version = SchemaVersion.V1_6)
50+ bom_json: str = outputter.output_as_string()
51+
52+ Alternatively, if the output format and schema version are constants, you can use the predefined format+schema combined outputs:
53+
54+ .. code-block :: python
55+
56+ from cyclonedx.output.json import JsonV1Dot6
57+
58+ outputter = JsonV1Dot6(bom = bom)
5059 bom_json: str = outputter.output_as_string()
5160
5261
@@ -58,7 +67,16 @@ written to the supplied filename.
5867
5968.. code-block :: python
6069
61- from cyclonedx.output import get_instance, BaseOutput, SchemaVersion
70+ from cyclonedx.output import make_outputter, BaseOutput, OutputFormat, SchemaVersion
71+
72+ outputter: BaseOutput = make_outputter(bom = bom, output_format = OutputFormat.XML , schema_version = SchemaVersion.V1_2)
73+ outputter.output_to_file(filename = ' /tmp/sbom-v1.2.xml' )
74+
75+ Alternatively, if the output format and schema version are constants, you can use the predefined format+schema combined outputs:
76+
77+ .. code-block :: python
78+
79+ from cyclonedx.output.xml import XmlV1Dot2
6280
63- outputter: BaseOutput = get_instance (bom = bom, schema_version = SchemaVersion.V1_2 )
64- outputter.output_to_file(filename = ' /tmp/sbom-v1.2.xml' )
81+ outputter = XmlV1Dot2 (bom = bom)
82+ outputter.output_to_file(filename = ' /tmp/sbom-v1.2.xml' )
0 commit comments