Open SCAP Library
|
XML schema based validation of XML representations of SCAP documents. More...
Typedefs | |
typedef enum oscap_document_type | oscap_document_type_t |
SCAP document type identifiers. | |
typedef int(* | xml_reporter) (const char *file, int line, const char *msg, void *arg) |
Functions | |
const char * | oscap_document_type_to_string (oscap_document_type_t type) |
Convert oscap_document_type_t constant to human readable (english) representation. More... | |
int | oscap_validate_document (const char *xmlfile, oscap_document_type_t doctype, const char *version, xml_reporter reporter, void *arg) |
Validate a SCAP document file against a XML schema. More... | |
int | oscap_schematron_validate_document (const char *xmlfile, oscap_document_type_t doctype, const char *version, const char *outfile) |
Validate a SCAP document file against schematron rules. More... | |
int | oscap_apply_xslt (const char *xmlfile, const char *xsltfile, const char *outfile, const char **params) |
Apply a XSLT stylesheet to a XML file. More... | |
const char * | oscap_path_to_schemas (void) |
Function returns path used to locate OpenSCAP XML schemas. | |
const char * | oscap_path_to_schematron (void) |
Function returns path used to locate OpenSCAP Schematron files. More... | |
const char * | oscap_path_to_cpe (void) |
Function returns path used to locate OpenSCAP Default CPE files. | |
int | oscap_determine_document_type (const char *document, oscap_document_type_t *doc_type) |
Determine document type. More... | |
XML schema based validation of XML representations of SCAP documents.
enum oscap_document_type |
SCAP document type identifiers.
int oscap_apply_xslt | ( | const char * | xmlfile, |
const char * | xsltfile, | ||
const char * | outfile, | ||
const char ** | params | ||
) |
Apply a XSLT stylesheet to a XML file.
If xsltfile is not an absolute path, the file will be searched relatively to a path specified by the OSCAP_XSLT_PATH environment variable. If the variable does not exist a default path is used (usually something like $PREFIX/share/openscap/schemas).
xmlfile | File to be transformed. |
xsltfile | XSLT file |
outfile | Result file shall be written here (NULL for stdout). |
params | list of key-value pairs to pass to the stylesheet. |
int oscap_determine_document_type | ( | const char * | document, |
oscap_document_type_t * | doc_type | ||
) |
Determine document type.
Please use oscap_source_get_scap_type instead.
const char* oscap_document_type_to_string | ( | oscap_document_type_t | type | ) |
Convert oscap_document_type_t constant to human readable (english) representation.
type | OpenSCAP Document Type |
Returned | value might be pointer to static memory and must not be modified. |
NULL | in case of unrecognized document type |
const char* oscap_path_to_schematron | ( | void | ) |
Function returns path used to locate OpenSCAP Schematron files.
It has never returned correct path to schematron files. This function may be dropped from the next version of the library.
int oscap_schematron_validate_document | ( | const char * | xmlfile, |
oscap_document_type_t | doctype, | ||
const char * | version, | ||
const char * | outfile | ||
) |
Validate a SCAP document file against schematron rules.
The rules are searched relative to path specified by the OSCAP_SCHEMA_PATH environment variable. If the variable does not exist a default path is used (usually something like $PREFIX/share/openscap/schemas).
xmlfile | File to be validated. |
doctype | Document type represented by the file. |
version | Version of the document, use NULL for library's default. |
outfile | Report from schematron validation is written into the outfile. If NULL, stdou will be used. |
int oscap_validate_document | ( | const char * | xmlfile, |
oscap_document_type_t | doctype, | ||
const char * | version, | ||
xml_reporter | reporter, | ||
void * | arg | ||
) |
Validate a SCAP document file against a XML schema.
Schemas are searched relative to path specified by the OSCAP_SCHEMA_PATH environment variable. If the variable does not exist a default path is used (usually something like $PREFIX/share/openscap/schemas).
Directory structure must adhere $SCHEMA_PATH/$STANDARD/$VERSION/$SCHEMAFILE.xsd structure, where $STANDARD is oval, xccdf, etc., and $VERSION is a version of the standard.
xmlfile | File to be validated. |
doctype | Document type represented by the file. |
version | Version of the document, use NULL for library's default. |
reporter | A reporter to by notified of encountered issues. Can be NULL, if a binary document validates / does not validate answer is satisfactonary. |
arg | Argument for the reporter. |