MCPcopy Create free account
hub / github.com/aboutcode-org/vulnerablecode / parseFromFile

Method parseFromFile

vulnerabilities/lib_oval.py:197–215  ·  view source on GitHub ↗

Load an OVAL document from a filename and parse that into an ElementTree Returns False if the filename is empty or there is an error parsing the XML document @type filename: string @param filename: The path to the OVAL XML document to parse @rtype: boolea

(self, filename)

Source from the content-addressed store, hash-verified

195 )
196
197 def parseFromFile(self, filename):
198 """
199 Load an OVAL document from a filename and parse that into an ElementTree
200 Returns False if the filename is empty or there is an error parsing the XML document
201 @type filename: string
202 @param filename: The path to the OVAL XML document to parse
203
204 @rtype: boolean
205 @return: True on success, otherwise False
206 """
207 try:
208 if not filename:
209 self.tree = None
210 return False
211 else:
212 self.tree = ElementTree.parse(filename)
213 return True
214 except Exception:
215 return False
216
217 def parseFromText(self, xmltext):
218 """

Callers

nothing calls this directly

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected