chartserver.py
def addXml(root,path,value):
	"""Adds an XML node or attribute to a tree of Elements.
	@param root: The root of the tree of Elements
	@param path: The path to the node or attribute. /elem/elem, /elem@attr, /elem@style$sty, etc.
	@param value: The value to be stored at path. May be inner text, attribute value, or style value depending on path.
	"""
	if (value != ""):
		elem = root
		while path.startswith('/'):
			parts = re.split('([/@$])',path[1:],1)
			if (len(parts) > 2):
				path = parts[1] + parts[2]
			else:
				path = ""
			for child in list(elem):
				if (child.tag == parts[0]):
					break
			if (len(elem) > 0 and child.tag == parts[0]):
				elem = child
			else:
				elem = ETree.SubElement(elem,parts[0])
		if (path == ""):
			elem.text = value
		elif (path.startswith('@')):
			path = path[1:]
			if (path.startswith('style$')):
				path = path[6:]
				elem.set('style',elem.get('style',"") + path + ": " + value + ";")
			else:
				elem.set(path,value)
Adds an XML node or attribute to a tree of Elements.
	@param root: The root of the tree of Elements
	@param path: The path to the node or attribute. /elem/elem, /elem@attr, /elem@style$sty, etc.
	@param value: The value to be stored at path. May be inner text, attribute value, or style value depending on path.
	
Adds an XML node or attribute to a tree of Elements.
Adds an XML node or attribute to a tree of Elements .
def addXml(root,path,value):
	if (value != ""):
		elem = root
		while path.startswith('/'):
			parts = re.split('([/@$])',path[1:],1)
			if (len(parts) > 2):
				path = parts[1] + parts[2]
			else:
				path = ""
			for child in list(elem):
				if (child.tag == parts[0]):
					break
			if (len(elem) > 0 and child.tag == parts[0]):
				elem = child
			else:
				elem = ETree.SubElement(elem,parts[0])
		if (path == ""):
			elem.text = value
		elif (path.startswith('@')):
			path = path[1:]
			if (path.startswith('style$')):
				path = path[6:]
				elem.set('style',elem.get('style',"") + path + ": " + value + ";")
			else:
				elem.set(path,value)
def addXml ( root , path , value ) : if ( value != "" ) : elem = root while path . startswith ( '/' ) : parts = re . split ( '([/@$])' , path [ 1 : ] , 1 ) if ( len ( parts ) > 2 ) : path = parts [ 1 ] + parts [ 2 ] else : path = "" for child in list ( elem ) : if ( child . tag == parts [ 0 ] ) : break if ( len ( elem ) > 0 and child . tag == parts [ 0 ] ) : elem = child else : elem = ETree . SubElement ( elem , parts [ 0 ] ) if ( path == "" ) : elem . text = value elif ( path . startswith ( '@' ) ) : path = path [ 1 : ] if ( path . startswith ( 'style$' ) ) : path = path [ 6 : ] elem . set ( 'style' , elem . get ( 'style' , "" ) + path + ": " + value + ";" ) else : elem . set ( path , value )
Adds an XML node or attribute to a tree of Elements.
Adds an XML node or attribute to a tree of Elements .
"""Adds an XML node or attribute to a tree of Elements.
	@param root: The root of the tree of Elements
	@param path: The path to the node or attribute. /elem/elem, /elem@attr, /elem@style$sty, etc.
	@param value: The value to be stored at path. May be inner text, attribute value, or style value depending on path.
	"""
root
The root of the tree of Elements
The root of the tree of Elements
path
The path to the node or attribute.
The path to the node or attribute .
value
The value to be stored at path. May be inner text, attribute value, or style value depending on path.
The value to be stored at path . May be inner text attribute value or style value depending on path .