Beispiel #1
0
def reduce_ElementTree(e):
	attrs = {axon.as_unicode(name):val for name,val in e.attrib.items()}
	if e.text:
		vals = [e.text]
	else:
		vals = []
	for child in e.getchildren():
		vals.append(child)
		if child.tail:
			vals.append(child.tail)
			child.tail = None
	if len(attrs) == 0:
		attrs = None
	if len(vals) == 0:
		vals = None
	return axon.node(axon.as_unicode(e.tag), attrs, vals)
Beispiel #2
0
def reduce_ElementTree(e):
	attrs = {axon.as_unicode(name):val for name,val in e.attrib.items()}
	if e.text:
		vals = [e.text]
	else:
		vals = []
	for child in e.getchildren():
		vals.append(child)
		if child.tail:
			vals.append(child.tail)
			child.tail = None
	if len(attrs) == 0:
		attrs = None
	if len(vals) == 0:
		vals = None
	return axon.node(axon.as_unicode(e.tag), attrs, vals)
Beispiel #3
0
def random_string(n):
    text = ''.join(chr(ord('a')+random.randint(1,20)) for i in range(20))
    text = axon.as_unicode(text)
    return text
Beispiel #4
0
def random_string(n):
    text = ''.join(chr(ord('a') + random.randint(1, 20)) for i in range(20))
    text = axon.as_unicode(text)
    return text