Exemplo n.º 1
0
def decimal_get_restriction_tag(interface, cls):
    restriction = simple_get_restriction_tag(interface, cls)

    if cls.Attributes.gt != Decimal.Attributes.gt:
        min_l = etree.SubElement(restriction, '{%s}minExclusive' % _ns_xs)
        min_l.set('value', str(cls.Attributes.gt))

    if cls.Attributes.ge != Decimal.Attributes.ge:
        min_l = etree.SubElement(restriction, '{%s}minInclusive' % _ns_xs)
        min_l.set('value', str(cls.Attributes.ge))

    if cls.Attributes.lt != Decimal.Attributes.lt:
        min_l = etree.SubElement(restriction, '{%s}maxExclusive' % _ns_xs)
        min_l.set('value', str(cls.Attributes.lt))

    if cls.Attributes.le != Decimal.Attributes.le:
        min_l = etree.SubElement(restriction, '{%s}maxInclusive' % _ns_xs)
        min_l.set('value', str(cls.Attributes.le))

    return restriction
Exemplo n.º 2
0
def decimal_get_restriction_tag(interface, cls):
    restriction = simple_get_restriction_tag(interface, cls)

    if cls.Attributes.gt != Decimal.Attributes.gt:
        min_l = etree.SubElement(restriction, '{%s}minExclusive' % _ns_xs)
        min_l.set('value', str(cls.Attributes.gt))

    if cls.Attributes.ge != Decimal.Attributes.ge:
        min_l = etree.SubElement(restriction, '{%s}minInclusive' % _ns_xs)
        min_l.set('value', str(cls.Attributes.ge))

    if cls.Attributes.lt != Decimal.Attributes.lt:
        min_l = etree.SubElement(restriction, '{%s}maxExclusive' % _ns_xs)
        min_l.set('value', str(cls.Attributes.lt))

    if cls.Attributes.le != Decimal.Attributes.le:
        min_l = etree.SubElement(restriction, '{%s}maxInclusive' % _ns_xs)
        min_l.set('value', str(cls.Attributes.le))

    return restriction
Exemplo n.º 3
0
def string_get_restriction_tag(interface, cls):
    restriction = simple_get_restriction_tag(interface, cls)

    # length
    if cls.Attributes.min_len == cls.Attributes.max_len:
        length = etree.SubElement(restriction, '{%s}length' % _ns_xs)
        length.set('value', str(cls.Attributes.min_len))

    else:
        if cls.Attributes.min_len != String.Attributes.min_len:
            min_l = etree.SubElement(restriction, '{%s}minLength' % _ns_xs)
            min_l.set('value', str(cls.Attributes.min_len))

        if cls.Attributes.max_len != String.Attributes.max_len:
            max_l = etree.SubElement(restriction, '{%s}maxLength' % _ns_xs)
            max_l.set('value', str(cls.Attributes.max_len))

    # pattern
    if cls.Attributes.pattern != String.Attributes.pattern:
        pattern = etree.SubElement(restriction, '{%s}pattern' % _ns_xs)
        pattern.set('value', cls.Attributes.pattern)

    return restriction
Exemplo n.º 4
0
def string_get_restriction_tag(interface, cls):
    restriction = simple_get_restriction_tag(interface, cls)

    # length
    if cls.Attributes.min_len == cls.Attributes.max_len:
        length = etree.SubElement(restriction, '{%s}length' % _ns_xs)
        length.set('value', str(cls.Attributes.min_len))

    else:
        if cls.Attributes.min_len != String.Attributes.min_len:
            min_l = etree.SubElement(restriction, '{%s}minLength' % _ns_xs)
            min_l.set('value', str(cls.Attributes.min_len))

        if cls.Attributes.max_len != String.Attributes.max_len:
            max_l = etree.SubElement(restriction, '{%s}maxLength' % _ns_xs)
            max_l.set('value', str(cls.Attributes.max_len))

    # pattern
    if cls.Attributes.pattern != String.Attributes.pattern:
        pattern = etree.SubElement(restriction, '{%s}pattern' % _ns_xs)
        pattern.set('value', cls.Attributes.pattern)

    return restriction