Package org.cyclonedx.generators.xml
Class BomXmlGenerator
java.lang.Object
org.cyclonedx.CycloneDxSchema
org.cyclonedx.generators.AbstractBomGenerator
org.cyclonedx.generators.xml.BomXmlGenerator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinterprotected static final StringFields inherited from class org.cyclonedx.generators.AbstractBomGenerator
bom, format, mapper, versionFields inherited from class org.cyclonedx.CycloneDxSchema
ALL_VERSIONS, NS_BOM_10, NS_BOM_11, NS_BOM_12, NS_BOM_13, NS_BOM_14, NS_BOM_15, NS_BOM_16, NS_BOM_LATEST, NS_DEPENDENCY_GRAPH_10, VERSION_LATEST -
Constructor Summary
ConstructorsConstructorDescriptionBomXmlGenerator(Bom bom, Version version) Constructs a new BomXmlGenerator object. -
Method Summary
Modifier and TypeMethodDescriptionprivate DocumentBuilderConstructs a new document builder with security features enabled.generate()Creates a CycloneDX BoM from a set of Components.protected DocumentgenerateDocument(Bom bom) private voidregisterDependencyModule(com.fasterxml.jackson.databind.ObjectMapper mapper, boolean useNamespace) private voidtoString()Creates a text representation of a CycloneDX BoM Document.(package private) StringMethods inherited from class org.cyclonedx.generators.AbstractBomGenerator
getFormat, getSchemaVersion, setupObjectMapperMethods inherited from class org.cyclonedx.CycloneDxSchema
getJsonSchema, getXmlSchema, getXmlSchema
-
Field Details
-
prettyPrinter
private final com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter prettyPrinter -
PROLOG
- See Also:
-
-
Constructor Details
-
BomXmlGenerator
Constructs a new BomXmlGenerator object.- Parameters:
bom- the BOM to generateversion- the version of the CycloneDX schema to use.
-
-
Method Details
-
setupObjectMapper
private void setupObjectMapper() -
registerDependencyModule
private void registerDependencyModule(com.fasterxml.jackson.databind.ObjectMapper mapper, boolean useNamespace) -
buildSecureDocumentBuilder
Constructs a new document builder with security features enabled.- Returns:
- a new document builder
- Throws:
ParserConfigurationException- thrown if there is a parser configuration exception
-
generateDocument
- Throws:
ParserConfigurationException
-
toXML
- Throws:
GeneratorException
-
generate
Creates a CycloneDX BoM from a set of Components.- Returns:
- an XML Document representing a CycloneDX BoM
- Throws:
ParserConfigurationException- if an error occurs- Since:
- 1.1.0
-
toXmlString
- Throws:
GeneratorException
-
toString
Creates a text representation of a CycloneDX BoM Document. This method callstoXmlString()and will return an empty string iftoXmlString()throws an exception. It's preferred to calltoXmlString()directly so that exceptions can be caught.
-