def _get_xml_tag(doc):
    """Returns document root xml tag.

    """
    tag = type(doc).type_key.split('.')[3]
    tag = convert.str_to_camel_case(tag)

    return tag
Exemple #2
0
def _get_xml_tag(doc):
    """Returns document root xml tag.

    """
    tag = type(doc).type_key.split('.')[3]
    tag = convert.str_to_camel_case(tag)

    return tag
Exemple #3
0
    def _decode(xml):
        # Set doc.
        doc, doc_type_info = _get_doc(xml, doc_type)

        # Set doc attributes.
        for _name, _type, _iterable in doc_type_info:
            # ... get xml element
            elem = xml.find(convert.str_to_camel_case(_name))

            # ... set attribute
            if elem is not None:
                decoder = _decode_complex if _type in _TYPES else _decode_simple
                setattr(doc, _name, decoder(elem, _type, _iterable))

        return doc
Exemple #4
0
    def _do(xml):
        # Set doc.
        doc, doc_type_info = _create_doc(xml, doc_type)

        # Set doc attributes:
        for _name, _type, _is_iterable in doc_type_info:
            # ... set xml element;
            _elem = xml.find(convert.str_to_camel_case(_name))

            # ... skip placeholders;
            if _elem is None:
                continue

            # ... complex types;
            elif _type in _TYPES:
                setattr(doc, _name, _decode(_elem, _type, _is_iterable))

            # ... simple types;
            else:
                setattr(doc, _name, _decode_simple(_elem, _type, _is_iterable))

        return doc
    def _do(xml):
        # Set doc.
        doc, doc_type_info = _create_doc(xml, doc_type)

        # Set doc attributes:
        for _name, _type, _is_iterable in doc_type_info:
            # ... set xml element;
            _elem = xml.find(convert.str_to_camel_case(_name))

            # ... skip placeholders;
            if _elem is None:
                continue

            # ... complex types;
            elif _type in _TYPES:
                setattr(doc, _name, _decode(_elem, _type, _is_iterable))

            # ... simple types;
            else:
                setattr(doc, _name, _decode_simple(_elem, _type, _is_iterable))

        return doc