예제 #1
0
def xml_to_enum(root):
    return filter_none({
        "$parent": get_fuzzy(root, "tag"),
        "name": get_fuzzy(root, "symbolicName"),
        "value": get_fuzzy(root, "value"),
        "history": xml_get_history(root),
        "docs": xml_get_docs(root),
    })
예제 #2
0
def xml_to_abbreviation(root):
    return (
        # Primary key.
        get_fuzzy(root, "abbrTerm"),
        {
            "term": get_fuzzy(root, "term"),
            "docs": xml_get_docs(root),
            "history": xml_get_history(root),
        },
    )
예제 #3
0
def xml_to_msg_content(root):
    return {
        "$parent": get_fuzzy(root, "ComponentID"),
        "tag": get_fuzzy(root, "TagText"),
        "kind": None,
        "position": float(get_fuzzy(root, "Position")),
        "optional": not bool(int(get_fuzzy(root, "Reqd"))),
        "inlined": bool(int(get_fuzzy(root, "Inlined") or "1")),
        "docs": xml_get_docs(root, body=True),
        "history": xml_get_history(root),
    }
예제 #4
0
def xml_to_refs(root):
    data = []
    if not root or not root.find("structure"):
        return data
    for child in root.find("structure"):
        data.append({
            "id": get_fuzzy(child, "id"),
            "docs": xml_get_docs(root, body=True),
            "history": xml_get_history(root),
        })
    return data
예제 #5
0
def xml_to_datatype(root):
    return (
        # Primary key.
        get_fuzzy(root, "name"),
        filter_none(
            {
                "base": get_fuzzy(root, "baseType", "base"),
                "docs": xml_get_docs(root, examples=True, body=True),
                "history": xml_get_history(root),
            }
        ),
    )
예제 #6
0
def xml_to_field(root):
    return (
        # Primary key.
        get_fuzzy(root, "id", "tag"),
        filter_none({
            "name": get_fuzzy(root, "name"),
            "datatype": get_fuzzy(root, "type"),
            "enum": xml_get_enum(root),
            "docs": xml_get_docs(root, body=True, elaboration=True),
            "history": xml_get_history(root),
        }),
    )
예제 #7
0
def xml_to_component(root):
    kind = get_fuzzy(root, "type", "ComponentType")
    return (
        # Primary key.
        get_fuzzy(root, "id", "ComponentID"),
        filter_none({
            "name": get_fuzzy(root, "name"),
            "nameAbbr": get_fuzzy(root, "abbrName", "nameAbbr"),
            "kind": kind.lower() if kind else None,
            "category": get_fuzzy(root, "category", "categoryID"),
            "docs": xml_get_docs(root, body=True, elaboration=True),
            "history": xml_get_history(root),
        }),
    )
예제 #8
0
def xml_to_section(root):
    return (
        # Primary key.
        get_fuzzy(root, "Id", "SectionID", "Name"),
        {
            "name": get_fuzzy(root, "Name"),
            "fixml": {
                "filename":
                get_fuzzy(root, "FIXMLFileName"),
                "optional":
                (lambda x: bool(int(x))
                 if x is not None else None)(get_fuzzy(root, "NotReqXML")),
            },
            "docs": xml_get_docs(root, volume=True, body=True),
            "history": xml_get_history(root),
        },
    )
예제 #9
0
def xml_to_message(root):
    return (
        # Primary key.
        get_fuzzy(root, "msgType"),
        {
            "$component": get_fuzzy(root, "id", "ComponentID"),
            "name": get_fuzzy(root, "Name"),
            "contents": xml_to_refs(root),
            "category": get_fuzzy(root, "Category", "CategoryID"),
            "fixml": {
                "optional":
                (lambda x: bool(int(x))
                 if x is not None else None)(get_fuzzy(root, "NotReqXML")),
            },
            "docs": xml_get_docs(root, body=True, elaboration=True),
            "history": xml_get_history(root),
        },
    )
예제 #10
0
def xml_to_category(root):
    return (
        # Primary key.
        get_fuzzy(root, "Id", "CategoryID", "Name"),
        {
            "kind": str.lower(get_fuzzy(root, "ComponentType")),
            "section": get_fuzzy(root, "Section", "SectionID"),
            "fixml": {
                "filename":
                get_fuzzy(root, "FIXMLFileName"),
                "generateImpl":
                get_fuzzy(root, "GenerateImplFile"),
                "optional":
                (lambda x: bool(int(x))
                 if x is not None else None)(get_fuzzy(root, "NotReqXML")),
            },
            "docs": xml_get_docs(root),
            "history": xml_get_history(root),
        },
    )