Adds property to XML_ToolsMixin that returns XML Header

* cafe/engine/models/base.py -- Added constants _XML_VERSION & _ENCODING with defaults of '1.0' & 'UTF-8' respectively
* cafe/engine/models/base.py -- Added property method xml_header which returns a formatted string to match the xml declaration header based on _XML_VERSION & _ENCODING

Change-Id: Id1a65c8d9ab8533c9205d3ba2d2c559f189d1891
This commit is contained in:
step6829
2013-11-13 11:54:50 -06:00
committed by step6829
parent d3e4ec5115
commit b48f35498d

View File

@@ -43,6 +43,14 @@ class JSON_ToolsMixin(object):
class XML_ToolsMixin(object):
"""Methods used to make building xml data models easier"""
_XML_VERSION = '1.0'
_ENCODING = 'UTF-8'
@property
def xml_header(self):
return "<?xml version='{version}' encoding='{encoding}'?>".format(
version=self._XML_VERSION, encoding=self._ENCODING)
@staticmethod
def _set_xml_etree_element(
xml_etree, property_dict, exclude_empty_properties=True):