프로젝트

일반

사용자정보

통계
| 개정판:

hytos / DTI_PID / DTI_PID / SymbolAttr.py @ 27b83026

이력 | 보기 | 이력해설 | 다운로드 (1.7 KB)

1
# coding: utf-8
2
"""
3
    This is Symbol Attribute module
4
"""
5

    
6
class SymbolAttr:
7
    """
8
    This is symbol attribute class
9
    """
10
    def __init__(self):
11
        self.UID = None
12
        self.Attribute = None
13
        self.DisplayAttribute = None
14
        self.AttributeType = None
15
        self.AttrAt = None
16
        self.Expression = None
17
        self.Length = None
18

    
19
    @staticmethod
20
    def fromXml(node):
21
        """
22
        generate SymbolAttr instance from xml node
23
        """
24

    
25
        attr = SymbolAttr()
26
        attr.UID = node.attrib['UID']
27
        attr.Attribute = node.attrib['Attribute']
28
        attr.DisplayAttribute = node.attrib['DisplayAttribute']
29
        attr.AttributeType = node.attrib['AttributeType']
30
        attr.AttrAt = node.attrib['AttrAt']
31
        attr.Expression = node.attrib['Expression']
32
        attr.Length = node.attrib['Length']
33

    
34
        return attr
35

    
36
    def toXml(self):
37
        """
38
        generate xml code for symbol attribute
39
        """
40
        from xml.etree.ElementTree import Element, SubElement, dump, ElementTree
41

    
42
        node = Element('ATTRIBUTE')
43
        node.attrib['UID'] = str(self.UID) if self.UID is not None else ''
44
        node.attrib['Attribute'] = self.Attribute if self.Attribute is not None else ''
45
        node.attrib['DisplayAttribute'] = self.DisplayAttribute if self.DisplayAttribute is not None else ''
46
        node.attrib['AttributeType'] = self.AttributeType if self.AttributeType is not None else ''
47
        node.attrib['AttrAt'] = str(self.AttrAt) if self.AttrAt is not None else ''
48
        node.attrib['Expression'] = self.Expression if self.Expression is not None else ''
49
        node.attrib['Length'] = str(self.Length) if self.Length is not None else ''
50

    
51
        return node
클립보드 이미지 추가 (최대 크기: 500 MB)