INNER CODE UNIT · Python

resources_xml

connectbot/connectbot · translations/test_translate.py:43

def resources_xml(inner: str) -> str:
    """Returns a full XML document string (with declaration) for writing to files."""
    return (
        '<?xml version="1.0" encoding="utf-8"?>\n'
        f'<resources xmlns:tools="{TOOLS_NS}">\n'
        f'{inner}\n'
        '</resources>\n'
    )


def resources_elem(inner: str) -> etree._Element:
    """Parses a <resources> element with comments preserved, without XML declaration."""
    xml = f'<resources xmlns:tools="http://schemas.android.com/tools">\n{inner}\n</resources>'
    return parse(xml)


# ---------------------------------------------------------------------------
# preceding_comment

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…