lib/parse/ParsedInput.py
def parseTree(dest,elem):
	"""Parses a tree of Elements into an IndexedDict tree.
	@param dest: Target IndexedDict; if nonempty, it will be extended
	@param elem: Root of the tree of Elements to be parsed
	"""
	attrib = dict(elem.items())
	for key in attrib:
		dest[key] = attrib[key]

	if (elem.text and elem.text.strip()):
		dest.text = elem.text.strip()
	else:
		dest.text = None

	append = ('append' in attrib and attrib['append'] == 'append')
	tagcount = dict()
	for child in list(elem):
		if (child.tag not in tagcount):
			tagcount[child.tag] = 0
			if (child.tag not in dest.keys()):
				dest[child.tag] = IndexedDict()
			if (len(dest[child.tag]) == 0 or append):
				tagcount[child.tag] = len(dest[child.tag])
				dest[child.tag].append(IndexedDict())
		else:
			tagcount[child.tag] += 1
			if (tagcount[child.tag] >= len(dest[child.tag])):
				dest[child.tag].append(IndexedDict())
		parseTree(dest[child.tag][tagcount[child.tag]],child)
Parses a tree of Elements into an IndexedDict tree.
	@param dest: Target IndexedDict; if nonempty, it will be extended
	@param elem: Root of the tree of Elements to be parsed
	
Parses a tree of Elements into an IndexedDict tree.
Parses a tree of Elements into an IndexedDict tree .
def parseTree(dest,elem):
	attrib = dict(elem.items())
	for key in attrib:
		dest[key] = attrib[key]
	if (elem.text and elem.text.strip()):
		dest.text = elem.text.strip()
	else:
		dest.text = None
	append = ('append' in attrib and attrib['append'] == 'append')
	tagcount = dict()
	for child in list(elem):
		if (child.tag not in tagcount):
			tagcount[child.tag] = 0
			if (child.tag not in dest.keys()):
				dest[child.tag] = IndexedDict()
			if (len(dest[child.tag]) == 0 or append):
				tagcount[child.tag] = len(dest[child.tag])
				dest[child.tag].append(IndexedDict())
		else:
			tagcount[child.tag] += 1
			if (tagcount[child.tag] >= len(dest[child.tag])):
				dest[child.tag].append(IndexedDict())
		parseTree(dest[child.tag][tagcount[child.tag]],child)
def parseTree ( dest , elem ) : attrib = dict ( elem . items ( ) ) for key in attrib : dest [ key ] = attrib [ key ] if ( elem . text and elem . text . strip ( ) ) : dest . text = elem . text . strip ( ) else : dest . text = None append = ( 'append' in attrib and attrib [ 'append' ] == 'append' ) tagcount = dict ( ) for child in list ( elem ) : if ( child . tag not in tagcount ) : tagcount [ child . tag ] = 0 if ( child . tag not in dest . keys ( ) ) : dest [ child . tag ] = IndexedDict ( ) if ( len ( dest [ child . tag ] ) == 0 or append ) : tagcount [ child . tag ] = len ( dest [ child . tag ] ) dest [ child . tag ] . append ( IndexedDict ( ) ) else : tagcount [ child . tag ] += 1 if ( tagcount [ child . tag ] >= len ( dest [ child . tag ] ) ) : dest [ child . tag ] . append ( IndexedDict ( ) ) parseTree ( dest [ child . tag ] [ tagcount [ child . tag ] ] , child )
Parses a tree of Elements into an IndexedDict tree.
Parses a tree of Elements into an IndexedDict tree .
"""Parses a tree of Elements into an IndexedDict tree.
	@param dest: Target IndexedDict; if nonempty, it will be extended
	@param elem: Root of the tree of Elements to be parsed
	"""
dest
Target IndexedDict; if nonempty, it will be extended
Target IndexedDict ; if nonempty it will be extended
elem
Root of the tree of Elements to be parsed
Root of the tree of Elements to be parsed