当前位置: 首页>>代码示例>>Python>>正文


Python PutGetXML.get_text_from_xml方法代码示例

本文整理汇总了Python中Modules.Utilities.xml_tools.PutGetXML.get_text_from_xml方法的典型用法代码示例。如果您正苦于以下问题:Python PutGetXML.get_text_from_xml方法的具体用法?Python PutGetXML.get_text_from_xml怎么用?Python PutGetXML.get_text_from_xml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Modules.Utilities.xml_tools.PutGetXML的用法示例。


在下文中一共展示了PutGetXML.get_text_from_xml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _read_one_interface_xml

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_one_interface_xml(p_interface_element):
     l_interface_obj = NodeInterfaceData()
     XmlConfigTools.read_base_object_xml(l_interface_obj, p_interface_element)
     l_interface_obj.MacAddress = PutGetXML.get_text_from_xml(p_interface_element, 'MacAddress')
     l_interface_obj.V4Address = PutGetXML.get_text_from_xml(p_interface_element, 'IPv4Address')
     l_interface_obj.V6Address = PutGetXML.get_text_from_xml(p_interface_element, 'IPv6Address')
     return l_interface_obj
开发者ID:,项目名称:,代码行数:9,代码来源:

示例2: read_internet_xml

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def read_internet_xml(self, p_house_obj, p_house_xml):
     """
     """
     p_house_obj.Internet = InternetData()
     l_sect = p_house_xml.find('Internet')
     try:
         self.m_external_ip = PutGetXML.get_text_from_xml(p_house_xml, 'ExternalIP')
         self.m_external_delay = PutGetXML.get_int_from_xml(l_sect, 'ExternalDelay')
     except AttributeError:
         LOG.error('internet section missing - using defaults.')
         self.m_external_ip = None
         self.m_external_url = None
         self.m_external_delay = 600
     # Design change - one of these two should work
     try:
         self.m_external_url = PutGetXML.get_text_from_xml(l_sect, 'ExternalUrl')
     except:
         self.m_external_url = PutGetXML.get_text_from_xml(l_sect, 'UrlExternalIP')
     p_house_obj.Internet.ExternalIP = self.m_external_ip
     p_house_obj.Internet.ExternalUrl = self.m_external_url
     p_house_obj.Internet.ExternalDelay = self.m_external_delay
     LOG.debug("Got external IP params.  URL:{0:}, Delay:{1:}".format(self.m_external_url, self.m_external_delay))
     try:
         l_list = l_sect.iterfind('DynamicDNS')
     except AttributeError:
         l_list = []
     l_count = 0
     for l_entry in l_list:
         l_dyndns = self.extract_dyn_dns(l_entry)
         l_dyndns.Key = l_count  # Renumber
         p_house_obj.Internet.DynDns[l_count] = l_dyndns
         l_count += 1
     LOG.info('Loaded UpdateUrl:{0:}, Delay:{1:}'.format(self.m_external_url, self.m_external_delay))
     return p_house_obj.Internet
开发者ID:,项目名称:,代码行数:36,代码来源:

示例3: _read_controller_data

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_controller_data(p_obj, p_xml, p_version):
     """
     There are extra fields for controllers - get them.
     See ControllerData()
     """
     p_obj.InterfaceType = PutGetXML.get_text_from_xml(p_xml, 'InterfaceType')
     p_obj.Port = PutGetXML.get_text_from_xml(p_xml, 'Port')
     return p_obj  # for testing
开发者ID:,项目名称:,代码行数:10,代码来源:

示例4: read_one_room

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def read_one_room(p_room_element):
     l_room_obj = RoomData()
     XmlConfigTools.read_base_object_xml(l_room_obj, p_room_element)
     l_room_obj.Comment = PutGetXML.get_text_from_xml(p_room_element, 'Comment')
     l_room_obj.Corner = PutGetXML.get_text_from_xml(p_room_element, 'Corner')
     l_room_obj.Floor = PutGetXML.get_text_from_xml(p_room_element, 'Floor', '1')
     l_room_obj.Size = PutGetXML.get_text_from_xml(p_room_element, 'Size')
     return l_room_obj
开发者ID:,项目名称:,代码行数:10,代码来源:

示例5: _read_one_lighting_schedule

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_one_lighting_schedule(p_schedule_element):
     """Extract schedule information from a schedule xml element.
     """
     l_obj = ScheduleLightData()
     l_obj.Level = PutGetXML.get_int_from_xml(p_schedule_element, 'Level')
     l_obj.LightName = PutGetXML.get_text_from_xml(p_schedule_element, 'LightName')
     l_obj.Rate = PutGetXML.get_int_from_xml(p_schedule_element, 'Rate')
     l_obj.RoomName = PutGetXML.get_text_from_xml(p_schedule_element, 'RoomName')
     return l_obj  # for testing
开发者ID:,项目名称:,代码行数:11,代码来源:

示例6: _read_one_login

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_one_login(p_xml):
     """
     @param p_xml: is the element of one login
     """
     l_obj = LoginData()
     XmlConfigTools.read_base_object_xml(l_obj, p_xml)
     l_obj.LoginFullName = PutGetXML.get_text_from_xml(p_xml, 'FullName')
     l_obj.LoginPasswordCurrent = PutGetXML.get_text_from_xml(p_xml, 'Password')
     l_obj.LoginRole = PutGetXML.get_text_from_xml(p_xml, 'Role')
     return l_obj
开发者ID:,项目名称:,代码行数:12,代码来源:

示例7: _read_thermostat_data

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_thermostat_data(p_obj, p_xml):
     """
     @return: a ThermostatData object.
     """
     p_obj.CoolSetPoint = PutGetXML.get_float_from_xml(p_xml, 'CoolSetPoint', p_default = 76.0)
     p_obj.HeatSetPoint = PutGetXML.get_float_from_xml(p_xml, 'HeatSetPoint', 68.0)
     p_obj.ThermostatMode = PutGetXML.get_text_from_xml(p_xml, 'ThermostatMode', 'Cool')
     p_obj.ThermostatScale = PutGetXML.get_text_from_xml(p_xml, 'ThermostatScale', 'F')
     #
     p_obj.CurrentTemperature = PutGetXML.get_float_from_xml(p_xml, 'CurrentTemperature')
     return p_obj
开发者ID:,项目名称:,代码行数:13,代码来源:

示例8: _read_device_latest

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_device_latest(p_device_obj, p_entry_xml):
     """
     """
     p_device_obj.Comment = PutGetXML.get_text_from_xml(p_entry_xml, 'Comment')
     p_device_obj.DeviceFamily = PutGetXML.get_text_from_xml(p_entry_xml, 'DeviceFamily')
     p_device_obj.DeviceType = PutGetXML.get_int_from_xml(p_entry_xml, 'DeviceType')
     p_device_obj.DeviceSubType = PutGetXML.get_int_from_xml(p_entry_xml, 'DeviceSubType')
     p_device_obj.LightingType = PutGetXML.get_text_from_xml(p_entry_xml, 'LightingType')
     p_device_obj.RoomCoords = PutGetXML.get_coords_from_xml(p_entry_xml, 'RoomCoords')
     p_device_obj.RoomName = PutGetXML.get_text_from_xml(p_entry_xml, 'RoomName')
     return p_device_obj
开发者ID:,项目名称:,代码行数:13,代码来源:

示例9: _read_device_v1_3

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_device_v1_3(p_device_obj, p_entry_xml):
     """
     Read the XML file version 1.3 - convert to 1.4
     """
     p_device_obj.Comment = ''
     p_device_obj.DeviceFamily = PutGetXML.get_text_from_xml(p_entry_xml, 'ControllerFamily')
     p_device_obj.DeviceType = 1
     p_device_obj.DeviceSubType = 0
     p_device_obj.LightingType = PutGetXML.get_text_from_xml(p_entry_xml, 'LightingType')
     p_device_obj.RoomCoords = PutGetXML.get_coords_from_xml(p_entry_xml, 'Coords')
     p_device_obj.RoomName = PutGetXML.get_text_from_xml(p_entry_xml, 'RoomName')
     return p_device_obj
开发者ID:,项目名称:,代码行数:14,代码来源:

示例10: read_xml

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def read_xml(self, p_pyhouse_obj):
     """
     @return: a EmailData object.
     """
     l_dict = EmailData()
     try:
         l_xml = p_pyhouse_obj.Xml.XmlRoot.find('ComputerDivision').find('EmailSection')
         l_dict.EmailFromAddress = PutGetXML.get_text_from_xml(l_xml, 'EmailFromAddress')
         l_dict.EmailToAddress = PutGetXML.get_text_from_xml(l_xml, 'EmailToAddress')
         l_dict.GmailLogin = PutGetXML.get_text_from_xml(l_xml, 'GmailLogin')
         l_dict.GmailPassword = PutGetXML.get_text_from_xml(l_xml, 'GmailPassword')
     except AttributeError as e_err:
         LOG.error('ERROR in mqtt_xml.read_xml() - {}'.format(e_err))
     return l_dict
开发者ID:,项目名称:,代码行数:16,代码来源:

示例11: _read_one_node_xml

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_one_node_xml(p_node_xml):
     """
     Read the existing XML file (if it exists) and get the node info.
     """
     l_node_obj = NodeData()
     XmlConfigTools.read_base_object_xml(l_node_obj, p_node_xml)
     l_node_obj.ConnectionAddr_IPv4 = PutGetXML.get_text_from_xml(p_node_xml, 'ConnectionAddressV4')
     l_node_obj.ConnectionAddr_IPv6 = PutGetXML.get_text_from_xml(p_node_xml, 'ConnectionAddressV6')
     l_node_obj.NodeRole = PutGetXML.get_int_from_xml(p_node_xml, 'NodeRole')
     try:
         l_node_obj.NodeInterfaces = Xml._read_interfaces_xml(p_node_xml.find('InterfaceSection'))
     except AttributeError as e_err:
         LOG.error('ERROR OneNodeRead error {}'.format(e_err))
     return l_node_obj
开发者ID:,项目名称:,代码行数:16,代码来源:

示例12: _read_insteon

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_insteon(p_in_xml):
     l_insteon_obj = InsteonData()
     try:
         l_insteon_obj.InsteonAddress = conversions.dotted_hex2int(PutGetXML.get_text_from_xml(p_in_xml, 'InsteonAddress', '99.88.77'))
     except AttributeError:
         l_insteon_obj.InsteonAddress = conversions.dotted_hex2int(PutGetXML.get_text_from_xml(p_in_xml, 'Address', '99.88.77'))
     try:
         l_insteon_obj.DevCat = conversions.dotted_hex2int(PutGetXML.get_text_from_xml(p_in_xml, 'DevCat', 'A1.B2'))
         l_insteon_obj.GroupList = PutGetXML.get_text_from_xml(p_in_xml, 'GroupList')
         l_insteon_obj.GroupNumber = PutGetXML.get_int_from_xml(p_in_xml, 'GroupNumber', 0)
         l_insteon_obj.ProductKey = Xml._read_product_key(p_in_xml)
         l_insteon_obj.Version = PutGetXML.get_int_from_xml(p_in_xml, 'Version', 1)
     except Exception as e_err:
         LOG.error('ERROR: {}'.format(e_err))
     return l_insteon_obj
开发者ID:,项目名称:,代码行数:17,代码来源:

示例13: _read_one_broker

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_one_broker(p_xml):
     """
     @param p_xml: XML information for one Broker.
     @return: an IrrigationZone object filled in with data from the XML passed in
     """
     l_obj = MqttBrokerData()
     try:
         XmlConfigTools.read_base_object_xml(l_obj, p_xml)
         l_obj.BrokerAddress = PutGetXML.get_text_from_xml(p_xml, 'BrokerAddress')
         l_obj.BrokerPort = PutGetXML.get_int_from_xml(p_xml, 'BrokerPort')
         l_obj.UserName = PutGetXML.get_text_from_xml(p_xml, 'BrokerUser')
         l_obj.Password = PutGetXML.get_text_from_xml(p_xml, 'BrokerPassword')
     except Exception:
         pass
     return l_obj
开发者ID:,项目名称:,代码行数:17,代码来源:

示例14: _read_product_key

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_product_key(p_entry_xml, p_default = '98.76.54'):
     l_ret = p_default
     try:
         l_prod = PutGetXML.get_text_from_xml(p_entry_xml, 'ProductKey', p_default)
         l_ret = conversions.dotted_hex2int(l_prod)
     except Exception:
         l_ret.ProductKey = p_default
     return l_ret
开发者ID:,项目名称:,代码行数:10,代码来源:

示例15: extract_dyn_dns

# 需要导入模块: from Modules.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def extract_dyn_dns(self, p_internet_xml):
     l_dyndns_obj = DynDnsData()
     self.read_base_object_xml(l_dyndns_obj, p_internet_xml)
     l_dyndns_obj.UpdateInterval = PutGetXML.get_int_from_xml(p_internet_xml, 'UpdateInterval')
     l_dyndns_obj.UpdateUrl = PutGetXML.get_text_from_xml(p_internet_xml, 'UpdateUrl')
     if g_debug >= 1:
         LOG.debug("internet.extract_dyn_dns() - Name:{0:}, UpdateInterval:{1:}, UpdateUrl:{2:};".format(
                         l_dyndns_obj.Name, l_dyndns_obj.UpdateInterval, l_dyndns_obj.UpdateUrl))
     return l_dyndns_obj
开发者ID:,项目名称:,代码行数:11,代码来源:


注:本文中的Modules.Utilities.xml_tools.PutGetXML.get_text_from_xml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。