本文整理汇总了Python中Modules.Utilities.xml_tools.PutGetXML.put_text_attribute方法的典型用法代码示例。如果您正苦于以下问题:Python PutGetXML.put_text_attribute方法的具体用法?Python PutGetXML.put_text_attribute怎么用?Python PutGetXML.put_text_attribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Modules.Utilities.xml_tools.PutGetXML
的用法示例。
在下文中一共展示了PutGetXML.put_text_attribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_empty_xml_skeleton
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import put_text_attribute [as 别名]
def _create_empty_xml_skeleton(p_pyhouse_obj):
l_xml = ET.Element("PyHouse")
PutGetXML.put_text_attribute(l_xml, 'Version', p_pyhouse_obj.Xml.XmlVersion)
PutGetXML.put_text_attribute(l_xml, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance')
PutGetXML.put_text_attribute(l_xml, 'xsi:schemaLocation', 'http://PyHouse.org schemas/PyHouse.xsd')
PutGetXML.put_text_attribute(l_xml, 'xmlns:comp', 'http://PyHouse.Org/ComputerDiv')
l_xml.append(ET.Comment(' Updated by PyHouse {} '.format(datetime.datetime.now())))
return l_xml
示例2: write_internet
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import put_text_attribute [as 别名]
def write_internet(self, p_house_obj):
"""Create a sub tree for 'Internet' - the sub elements do not have to be present.
@return: a sub tree ready to be appended to "something"
"""
l_internet_xml = ET.Element('Internet')
PutGetXML.put_text_attribute(l_internet_xml, 'ExternalIP', p_house_obj.Internet.ExternalIP)
PutGetXML.put_int_attribute(l_internet_xml, 'ExternalDelay', p_house_obj.Internet.ExternalDelay)
PutGetXML.put_text_attribute(l_internet_xml, 'ExternalUrl', p_house_obj.Internet.ExternalUrl)
try:
for l_dyndns_obj in p_house_obj.Internet.DynDns.itervalues():
l_entry = self.write_base_object_xml('DynamicDNS', l_dyndns_obj)
PutGetXML.put_int_element(l_entry, 'UpdateInterval', l_dyndns_obj.UpdateInterval)
PutGetXML.put_text_element(l_entry, 'UpdateUrl', l_dyndns_obj.UpdateUrl)
l_internet_xml.append(l_entry)
except AttributeError:
pass
return l_internet_xml
示例3: create_xml_config_foundation
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import put_text_attribute [as 别名]
def create_xml_config_foundation(p_pyhouse_obj):
"""
Create the "PyHouse" top element of the XML config file.
The other divisions are appended to this foundation.
"""
l_xml = ET.Element("PyHouse")
PutGetXML.put_text_attribute(l_xml, 'Version', p_pyhouse_obj.Xml.XmlVersion)
PutGetXML.put_text_attribute(l_xml, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance')
PutGetXML.put_text_attribute(l_xml, 'xsi:schemaLocation', 'http://PyHouse.org schemas/PyHouse.xsd')
PutGetXML.put_text_attribute(l_xml, 'xmlns:comp', 'http://PyHouse.Org/ComputerDiv')
l_xml.append(ET.Comment(' Updated by PyHouse {} '.format(datetime.datetime.now())))
return l_xml
示例4: write_base_device_object_xml
# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import put_text_attribute [as 别名]
def write_base_device_object_xml(p_element_tag, p_obj):
"""
@param p_element_tag: is the element name that we are going to create.
@param p_obj: is the object that contains the device data for which we will output the XML
@return: the XML element with children that we will create.
"""
l_elem = ET.Element(p_element_tag)
PutGetXML.put_text_attribute(l_elem, "Name", p_obj.Name)
PutGetXML.put_int_attribute(l_elem, "Key", p_obj.Key)
PutGetXML.put_bool_attribute(l_elem, "Active", p_obj.Active)
# add sub elements
try:
PutGetXML.put_uuid_element(l_elem, "UUID", p_obj.UUID)
except AttributeError:
PutGetXML.put_uuid_element(l_elem, "UUID", "No UUID Given")
PutGetXML.put_text_element(l_elem, "Comment", p_obj.Comment)
PutGetXML.put_text_element(l_elem, "DeviceFamily", p_obj.DeviceFamily)
PutGetXML.put_int_element(l_elem, "DeviceType", p_obj.DeviceType)
PutGetXML.put_int_element(l_elem, "DeviceSubType", p_obj.DeviceSubType)
PutGetXML.put_coords_element(l_elem, "RoomCoords", p_obj.RoomCoords)
PutGetXML.put_text_element(l_elem, "RoomName", p_obj.RoomName)
return l_elem