Open SCAP Library
Typedefs | Enumerations | Functions
Validation
Common

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.

Enumerations

enum  oscap_document_type {
  OSCAP_DOCUMENT_OVAL_DEFINITIONS = 1, OSCAP_DOCUMENT_OVAL_VARIABLES, OSCAP_DOCUMENT_OVAL_SYSCHAR, OSCAP_DOCUMENT_OVAL_RESULTS,
  OSCAP_DOCUMENT_OVAL_DIRECTIVES, OSCAP_DOCUMENT_XCCDF, OSCAP_DOCUMENT_CPE_LANGUAGE, OSCAP_DOCUMENT_CPE_DICTIONARY
}
 SCAP document type identifiers. More...

Functions

bool oscap_validate_document (const char *xmlfile, oscap_document_type_t doctype, const char *version, oscap_reporter reporter, void *arg)
 Validate a SCAP document file against a XML schema.
bool oscap_apply_xslt (const char *xmlfile, const char *xsltfile, const char *outfile, const char **params)
 Apply a XSLT stylesheet to a XML file.
bool oscap_apply_xslt_var (const char *xmlfile, const char *xsltfile, const char *outfile, const char **params, const char *pathvar, const char *defpath)
 Apply XSLT stylesheet to a XML file.

Detailed Description

XML schema based validation of XML representations of SCAP documents.


Enumeration Type Documentation

SCAP document type identifiers.

Enumerator:
OSCAP_DOCUMENT_OVAL_DEFINITIONS 

OVAL Definitions file.

OSCAP_DOCUMENT_OVAL_VARIABLES 

OVAL Variables.

OSCAP_DOCUMENT_OVAL_SYSCHAR 

OVAL system characteristics file.

OSCAP_DOCUMENT_OVAL_RESULTS 

OVAL results file.

OSCAP_DOCUMENT_OVAL_DIRECTIVES 

OVAL directives file.

OSCAP_DOCUMENT_XCCDF 

XCCDF benchmark file.

OSCAP_DOCUMENT_CPE_LANGUAGE 

CPE language file.

OSCAP_DOCUMENT_CPE_DICTIONARY 

CPE dictionary file.


Function Documentation

bool oscap_apply_xslt ( const char *  xmlfile,
const char *  xsltfile,
const char *  outfile,
const char **  params 
)

Apply a XSLT stylesheet to a XML file.

Stylesheets are searched relative to path specified by the OSCAP_XSLT_PATH environment variable, which contains a list of colon-separated paths. If the variable does not exist a default path is used (usually something like $PREFIX/share/openscap/schemas).

Parameters:
xmlfileFile to be transformed.
xsltfileXSLT filename
outfileResult file shall be written here (NULL for stdout).
paramslist of key-value pairs to pass to the stylesheet.
Returns:
Success or failure.
bool oscap_apply_xslt_var ( const char *  xmlfile,
const char *  xsltfile,
const char *  outfile,
const char **  params,
const char *  pathvar,
const char *  defpath 
)

Apply XSLT stylesheet to a XML file.

This function lets user specify environment variable with a XSL stylesheet search path(s) and a fallback path if the variable is not defined. Except for this it is completely identical to oscap_apply_xslt().

Parameters:
xmlfileFile to be transformed.
xsltfileXSLT filename
outfileResult file shall be written here (NULL for stdout).
paramslist of key-value pairs to pass to the stylesheet.
Returns:
Success or failure.
bool oscap_validate_document ( const char *  xmlfile,
oscap_document_type_t  doctype,
const char *  version,
oscap_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, which contains a list of colon-separated paths. 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.

Parameters:
xmlfileFile to be validated.
doctypeDocument type represented by the file.
versionVersion of the document, use NULL for library's default.
reporetrA reporter to by notified of encountered issues. Can be NULL, if a binary document validates / does not validate answer is satisfactonary.
argArgument for the reporter.
Returns:
Success or failure.