CPELanguage class

class cpe.cpelang.CPELanguage(expression, isFile=False)

Represents an expression in the CPE Language.

This class allows match a CPE element against an expression in the CPE Language, that is, a XML document format for binding descriptive prose and diagnostic test to a CPE Name (CPE Description Format).

__init__(expression, isFile=False)

Create an object that contains the input expression in the CPE Language (a set of CPE Names) and the DOM tree asociated with expression.

Parameters:
  • expression (string) – XML content in string or a path to XML file
  • isFile (strint) – indicates whether expression is a XML file or XML content string
Returns:

None

__str__()

Returns a human-readable representation of CPE Language expression.

Returns:Representation of CPE Language expression as string
Return type:string
__weakref__

list of weak references to the object (if defined)

language_match(cpeset, cpel_dom=None)

Accepts a set of known CPE Names and an expression in the CPE language, and delivers the answer True if the expression matches with the set. Otherwise, it returns False.

Parameters:
  • self (CPELanguage) – An expression in the CPE Language, represented as the XML infoset for the platform element.
  • cpeset (CPESet) – CPE set object to match with self expression.
  • cpel_dom (string) – An expression in the CPE Language, represented as DOM tree.
Returns:

True if self expression can be satisfied by language matching against cpeset, False otherwise.

Return type:

boolean

Exception:

NotImplementedError - Method not implemented