Contains information about this OvalDocument, such as the schema version, the product that produced it, and when it was produced
| 559 | |
| 560 | |
| 561 | class OvalGenerator(object): |
| 562 | """ |
| 563 | Contains information about this OvalDocument, such as the schema version, the product that produced it, and when it was produced |
| 564 | """ |
| 565 | |
| 566 | def __init__(self, element): |
| 567 | self.element = element |
| 568 | |
| 569 | def getProduct(self): |
| 570 | """ |
| 571 | Gets the value of the product element |
| 572 | """ |
| 573 | if self.element is None: |
| 574 | return None |
| 575 | |
| 576 | # child = self.element.find("{http://oval.mitre.org/XMLSchema/oval-common-5}product_name") |
| 577 | child = self.element.find("oval:product_name", OvalDocument.NS_OVAL) |
| 578 | if child is None: |
| 579 | return None |
| 580 | else: |
| 581 | return child.text |
| 582 | |
| 583 | def get_element(self): |
| 584 | return self.element |
| 585 | |
| 586 | def setProduct(self, product): |
| 587 | """ |
| 588 | Sets a value for the product element. If a product element does not already exist, one will be created |
| 589 | """ |
| 590 | if self.element is None: |
| 591 | return False |
| 592 | |
| 593 | if product is None: |
| 594 | return False |
| 595 | |
| 596 | child = self.element.find("oval:product_name", OvalDocument.NS_OVAL) |
| 597 | if child is not None: |
| 598 | child.text = product |
| 599 | else: |
| 600 | child = Element("{" + OvalDocument.NS_DEFAULT.get("def") + "}product_name") |
| 601 | child.text = product |
| 602 | self.element.append(child) |
| 603 | |
| 604 | def getSchemaVersion(self): |
| 605 | """ |
| 606 | Gets the value of the schema_version element |
| 607 | """ |
| 608 | if self.element is None: |
| 609 | return None |
| 610 | |
| 611 | child = self.element.find("oval:schema_version", OvalDocument.NS_OVAL) |
| 612 | if child is not None: |
| 613 | return child.text |
| 614 | else: |
| 615 | return None |
| 616 | |
| 617 | def setSchemaVersion(self, version): |
| 618 | """ |
no outgoing calls
no test coverage detected