xml_reader module¶
-
class
xml_reader.
Xml_reader
(xml_path: str, xsd_path: str)¶ Bases:
object
reader for the XML configuration
-
get_buffer_size
(device_name: str) → int¶ method to read the buffer size of a given device from the XML
Parameters: device_name (str) – the name of a device Raises: NameError
– device_name will be checked against the config XMLReturns: the buffer size for the device Return type: int
-
get_device_names
() → list¶ lists all the device names from the config XML
Returns: all device names as strings Return type: list
-
get_port
(device_name: str) → dict¶ returns the information about a port of a given device
Parameters: device_name (str) – the name of a device Returns: {‘protocol’, [list: pins]} Return type: dict Raises: NameError
– device_name will be checked against the config XML
-
set_root
(xml_path: str)¶ method to read and store the root element from the XML file
Parameters: xml_path (str) – the path to the XML file
-
validate
(xml_path: str, xsd_path: str) → bool¶ validates a XML by using a XSD file
Parameters: - xml_path (str) – the path to the XML file
- xsd_path (str) – the path to the XSD file
Returns: result of the validation
Return type: bool
-