plsxml.PLSXML¶
-
class
plsxml.
PLSXML
(path=None, tables=None, verbose=False)[source]¶ A class for parsing PLS-CADD XML files.
Parameters: - path : str or list, default is None
A string or list of strings defining the ZIP or XML file path(s). If None, then no files will be loaded.
- tables : list, default is None
A list of strings defining the table names to be loaded from the referenced XML files. If None, then all tables in the XML files will be parsed.
- verbose : bool, default is False
If True, status messages will be printed during the parsing process. This can be useful to see the progress of long XML files.
Examples
>>> from plsxml import PLSXML >>> from plsxml.data import data_path
To load data from the intializer:
>>> path = data_path('galloping') # DATA_FOLDER/galloping.xml >>> xml = PLSXML(path)
You can add files after the initialization via the append method:
>>> xml.append(path)
The class is a subclass of a dictionary. Once loaded, data can be accessed via table name > column name > row index:
>>> xml['galloping_ellipses_summary']['minimum_clearance_galloping_ellipse_method'][0] 'Single mid span'
A summary of keys can be acquired via the table_summary method:
>>> print(xml.table_summary()) galloping_ellipses_summary rowtext None structure 'TERM' set 1 phase 1 ahead_span_length 258.2 minimum_clearance_set 1 minimum_clearance_phase 2 minimum_clearance_galloping_ellipse_method 'Single mid span' minimum_clearance_distance 1.52 minimum_clearance_overlap 0.0 minimum_clearance_wind_from 'Left' minimum_clearance_mid_span_sag 12.15 minimum_clearance_insulator_swing_angle 0.0 minimum_clearance_span_swing_angle 63.1 minimum_clearance_major_axis_length 16.2 minimum_clearance_minor_axis_length 6.5 minimum_clearance_b_distance 3.0
Methods
append
(path[, tables])Parses the input file into the class dictionary. table_summary
()Returns a string of all parsed tables, keys, and example values.