def addBeginEndInnerXMLTag(attributes, depth, innerText, localName, output, text=''):
	'Add the begin and end xml tag and the inner text if any.'
	if len( innerText ) > 0:
		addBeginXMLTag(attributes, depth, localName, output, text)
		output.write( innerText )
		addEndXMLTag(depth, localName, output)
	else:
		addClosedXMLTag(attributes, depth, localName, output, text)