This ConFM class parses the XML configuration files provided by the openSF HMI formatted
with the following elements:
- Element <group_name>. This element can create nested groups to enclose parameters and
provide scope information. Optional element.
- Element parameter. This element can define the following attributes:
- Name. This is the parameter identifier. Names cannot contain spaces
- Description. Short definition or meaning for the parameter
- Type. Possible values for this attribute are: INTEGER, DOUBLE, BOOLEAN, STRING,
FILE or FOLDER. These are system-independent type of values, only intended for
GUI formatting validations.
- Value. This is the numerical, string or file location value of the parameter
- Units. Physical units of measurements if applicable. This attribute is optional
- Dims. Size of the dimensions. For example 1, 3 is a vector of three elements and
3, 3 is a square matrix of 3x3 elements. The first number refers to columns
and the second one to rows when describing a matrix. This attribute is optional
for scalar variables.
For variables of vector/matrix types, the value attribute must contain a
comma-separated (or blank-separated) list of values by rows, following this example:
A 3 columns by 2 rows matrix (dims = 3,2)
1 2 3
4 5 6
Will be represented as: 1,2,3,4,5,6.
String vectors must enclose each element in single quotes. For example
'a string' 'second string' 'third and last string'.
def OSFI.ParamReader.ParamReader.__init__ |
( |
|
self, |
|
|
|
xmlFile, |
|
|
|
xsdFile = None |
|
) |
| |
Default class constructor.
Creates an instance of the ParamReader class, parses a given configuration XML file and
stores every valid parameter.</p>
<p>Validating against an XSD schema is optional.</p>
@param xmlFile - Configuration XML file
@param xsdFile - IGNORED, will generate a deprecation warning
@throw exception if error while parsing
References OSFI.ParamReader.ParamReader.__root, OSFI.ParamReader.ParamReader.__traverseNodes(), and OSFI.ParamReader.ParamReader.__tree.
def OSFI.ParamReader.ParamReader.validateAgainstInternalSchema |
( |
|
self | ) |
|
Validate the XML document read against the schema linked in the document itself, logging
any problems found.
@return True if validation succeds, False otherwise.
@throw ValueError If the document does not link to a XSD schema using the "schemaLocation"
or "noNamespaceSchemaLocation" attributes from the
"http://www.w3.org/2001/XMLSchema-instance" namespace.
@throw Exception If the linked schema cannot be loaded
@throw NotImplementedError If the ElementTree library does not implement XSD validation
References OSFI.ParamReader.ParamReader.__doValidate(), and OSFI.ParamReader.ParamReader.__root.