示例#1
0
def parse(something):
    try:
        if something.startswith('<?llsd/binary?>'):
            just_binary = something.split('\n', 1)[1]
            return LLSDBinaryParser().parse(just_binary)
        # This should be better.
        elif something.startswith('<'):
            return to_python(fromstring(something)[0])
        else:
            return LLSDNotationParser().parse(something)
    except KeyError, e:
        raise Exception('LLSD could not be parsed: %s' % (e,))
示例#2
0
def parse_xml(something):
    try:
        return to_python(fromstring(something)[0])
    except ElementTreeError, err:
        raise LLSDParseError(*err.args)
示例#3
0
def parse_xml(something):
    try:
        return to_python(fromstring(something)[0])
    except ElementTreeError, err:
        raise LLSDParseError(*err.args)