Exemplo n.º 1
0
def loads(s, map=None, cls=None, **kwargs):
    """
    Parse C{s} (a C{str} or C{unicode} instance containing an XML document)
    and return a dotted-name-walkable L{SimpleXmlApi} instance.

    If map is specified, attributes will be created on the returned
    instance mapping map's keys to its associated dotted-name values.

    To use a custom L{SimpleXmlApi} subclass, specify it with the L{cls}
    kwarg.
    """
    return _factory(s, map, cls, **kwargs)
Exemplo n.º 2
0
def load(fp, map=None, cls=None, **kwargs):
    """
    Parse C{fp} (a file-like object containing an XML document) and return a
    dotted-name-walkable L{SimpleXmlApi} instance.

    If C{map} is specified, attributes will be created on the returned
    instance mapping L{map}'s keys to its associated dotted-name values.

    To use a custom L{SimpleXmlApi} subclass, specify it with the C{cls}
    kwarg.
    """
    return _factory(fp.read(), map, cls, **kwargs)