示例#1
0
    def toeeml(self):
        """
        Convert this element into a DOM object.

        :return: a data element
        :rtype: `Element`
        """

        data = _elem("data")

        _addA(data, self._id, "id", str)
        for tag in self._tags:
            _addE(data, tag, "tag")

        if self._value is not None:
            tmp = _elem("current_value")
            _addA(tmp, self._minValue, "minValue", str)
            _addA(tmp, self._maxValue, "maxValue", str)
            _addA(tmp, self._at, "at", lambda x: x.isoformat())
            tmp.text = str(self._value)
            data.append(tmp)

        if self._unit is not None:
            data.append(self._unit.toeeml())

        if self._datapoints is not None:
            data.append(self._datapoints.toeeml())

        return data
示例#2
0
    def toeeml(self):
        """
        Convert this element into a DOM object.

        :return: a data element
        :rtype: `Element`
        """

        data = _elem('data')

        _addA(data, self._id, 'id', str)
        for tag in self._tags:
            _addE(data, tag, 'tag')

        if self._value is not None:
            tmp = _elem('current_value')
            _addA(tmp, self._minValue, 'minValue', str)
            _addA(tmp, self._maxValue, 'maxValue', str)
            _addA(tmp, self._at, 'at', lambda x: x.isoformat())
            tmp.text = str(self._value)
            data.append(tmp)

        if self._unit is not None:
            data.append(self._unit.toeeml())

        if self._datapoints is not None:
            data.append(self._datapoints.toeeml())

        return data
示例#3
0
    def toeeml(self):
        """
        Convert this element into a DOM object.

        :return: a data element
        :rtype: `Element`
        """

        data = _elem('data')

        _addA(data, self._id, 'id', str)
        for tag in self._tags:
            _addE(data, tag, 'tag')

        if self._value is not None:
            tmp = _elem('current_value')
            _addA(tmp, self._minValue, 'minValue', str)
            _addA(tmp, self._maxValue, 'maxValue', str)
            _addA(tmp, self._at, 'at', lambda x: x.isoformat())
            tmp.text = str(self._value)
            data.append(tmp)

        if self._unit is not None:
            data.append(self._unit.toeeml())

        if self._datapoints is not None:
            data.append(self._datapoints.toeeml())
            
        return data
示例#4
0
    def toeeml(self):
        """
        Convert this class into a EEML DOM element.

        :return: the location element
        :rtype: `Element`
        """

        loc = _elem('location')

        _addA(loc, self._exposure, 'exposure')
        _addA(loc, self._domain, 'domain')
        _addA(loc, self._disposition, 'disposition')
        _addE(loc, self._name, 'name')
        _addE(loc, self._lat, 'lat', str)
        _addE(loc, self._lon, 'lon', str)
        _addE(loc, self._ele, 'ele', str)

        return loc
示例#5
0
    def toeeml(self):
        """
        Convert this class into a EEML DOM element.

        :return: the location element
        :rtype: `Element`
        """

        loc = _elem("location")

        _addA(loc, self._exposure, "exposure")
        _addA(loc, self._domain, "domain")
        _addA(loc, self._disposition, "disposition")
        _addE(loc, self._name, "name")
        _addE(loc, self._lat, "lat", str)
        _addE(loc, self._lon, "lon", str)
        _addE(loc, self._ele, "ele", str)

        return loc
示例#6
0
    def toeeml(self):
        """
        Convert this class into a EEML DOM element.

        :return: the location element
        :rtype: `Element`
        """

        loc = _elem('location')

        _addA(loc, self._exposure, 'exposure')
        _addA(loc, self._domain, 'domain')
        _addA(loc, self._disposition, 'disposition')
        _addE(loc, self._name, 'name')
        _addE(loc, self._lat, 'lat', str)
        _addE(loc, self._lon, 'lon', str)
        _addE(loc, self._ele, 'ele', str)

        return loc
示例#7
0
    def toeeml(self):
        """
        Convert this file into eeml format.

        :return: the top element of this `Environment`
        :rtype: `Element`
        """
        env = _elem('environment')
        if isinstance(self._updated, (
                date,
                datetime,
        )):
            _addA(env, self._updated, 'updated', lambda x: x.isoformat())
        elif self._updated is not None:
            _addA(env, self._updated, 'updated')
        _addA(env, self._creator, 'creator')
        _addA(env, self._id, 'id', str)
        _addE(env, self._title, 'title')
        _addE(env, self._feed, 'feed')
        _addE(env, self._status, 'status')
        _addE(env, self._description, 'description')
        _addE(env, self._icon, 'icon')
        _addE(env, self._website, 'website')
        _addE(env, self._email, 'email')
        _addE(env, self._private, 'private', lambda x: str(x).lower())
        if self._location is not None:
            env.append(self._location.toeeml())
        for (dataId, data) in self._data.iteritems():
            env.append(data.toeeml())
        return env
示例#8
0
    def toeeml(self):
        """
        Convert this file into eeml format.

        :return: the top element of this `Environment`
        :rtype: `Element`
        """
        env = _elem("environment")
        if isinstance(self._updated, (date, datetime)):
            _addA(env, self._updated, "updated", lambda x: x.isoformat())
        elif self._updated is not None:
            _addA(env, self._updated, "updated")
        _addA(env, self._creator, "creator")
        _addA(env, self._id, "id", str)
        _addE(env, self._title, "title")
        _addE(env, self._feed, "feed")
        _addE(env, self._status, "status")
        _addE(env, self._description, "description")
        _addE(env, self._icon, "icon")
        _addE(env, self._website, "website")
        _addE(env, self._email, "email")
        _addE(env, self._private, "private", lambda x: str(x).lower())
        if self._location is not None:
            env.append(self._location.toeeml())
        for data in self._data:
            env.append(data.toeeml())
        return env
示例#9
0
    def toeeml(self):
        """
        Convert this file into eeml format.

        :return: the top element of this `Environment`
        :rtype: `Element`
        """
        env = _elem('environment')
        if isinstance(self._updated, (date, datetime,)):
            _addA(env, self._updated, 'updated', lambda x: x.isoformat())
        elif self._updated is not None:
            _addA(env, self._updated, 'updated')
        _addA(env, self._creator, 'creator')
        _addA(env, self._id, 'id', str)
        _addE(env, self._title, 'title')
        _addE(env, self._feed, 'feed')
        _addE(env, self._status, 'status')
        _addE(env, self._description, 'description')
        _addE(env, self._icon, 'icon')
        _addE(env, self._website, 'website')
        _addE(env, self._email, 'email')
        _addE(env, self._private, 'private', lambda x: str(x).lower())
        if self._location is not None:
            env.append(self._location.toeeml())
        for (dataId, data) in self._data.iteritems():
            env.append(data.toeeml())
        return env