@@ -44,9 +44,18 @@ as a ``str``.
44
44
45
45
.. code-block :: python
46
46
47
- from cyclonedx.output import get_instance , BaseOutput, OutputFormat
47
+ from cyclonedx.output import make_outputter , BaseOutput, OutputFormat, SchemaVersion
48
48
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)
50
59
bom_json: str = outputter.output_as_string()
51
60
52
61
@@ -58,7 +67,16 @@ written to the supplied filename.
58
67
59
68
.. code-block :: python
60
69
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
62
80
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