__init__(self,
xmlData=None,
xmlPath=None,
validate=True)
(Constructor)
| source code
|
Initializes a configuration object.
If you initialize the object without passing either
xmlData or xmlPath then configuration will be
empty and will be invalid until it is filled in properly.
No reference to the original XML data or original path is saved off by
this class. Once the data has been parsed (successfully or not) this
original information is discarded.
Unless the validate argument is False , the
LocalConfig.validate method will be called (with its
default arguments) against configuration after successfully parsing any
passed-in XML. Keep in mind that even if validate is
False , it might not be possible to parse the passed-in XML
document if lower-level validations fail.
- Parameters:
xmlData (String data.) - XML data representing configuration.
xmlPath (Absolute path to a file on disk.) - Path to an XML file on disk.
validate (Boolean true/false.) - Validate the document after parsing it.
- Raises:
ValueError - If both xmlData and xmlPath are
passed-in.
ValueError - If the XML data in xmlData or xmlPath
cannot be parsed.
ValueError - If the parsed configuration document is not valid.
- Overrides:
object.__init__
Note:
It is strongly suggested that the validate option
always be set to True (the default) unless there is a
specific need to read in invalid configuration from disk.
|