Ejemplo n.º 1
0
    def create_element(self,
                       name,
                       ns=None,
                       prefix=None,
                       attrs=None,
                       text=None):
        """Создание нового элемента"""
        new_element = Element(name, ns=ns)
        if prefix:
            new_element.setPrefix(prefix)

        if attrs:
            for k, v in attrs.items():
                new_element.set(k, v)

        if text:
            new_element.setText(text)
        return new_element
def create_version():
    el = Element('Version')
    el.setPrefix('ns0')

    major_release = Element('majorRelease')
    major_release.setPrefix('ns0')
    major_release.setText('1')
    el.append(major_release)

    minor_release = Element('minorRelease')
    minor_release.setPrefix('ns0')
    minor_release.setText('18')
    el.append(minor_release)

    return {
        'majorRelease': '1',
        'minorRelease': '0',
    }

    return el
def create_version():
    el = Element('Version')
    el.setPrefix('ns0')

    major_release = Element('majorRelease')
    major_release.setPrefix('ns0')
    major_release.setText('1')
    el.append(major_release)

    minor_release = Element('minorRelease')
    minor_release.setPrefix('ns0')
    minor_release.setText('18')
    el.append(minor_release)

    return {
        'majorRelease': '1',
        'minorRelease': '0',
    }

    return el