code: public Element createOrUpdateSingleChild(Element parent, String type) {
  		Element result = null;
  		if (parent.getElementsByTagName(type).getLength() == 0) {
  			switch (namespace) {
  				case HTML:
  					result = Dom.createElementNS(Dom.NS_HTML, type);
  					break;
  				case SVG:
  					result = Dom.createElementNS(Dom.NS_SVG, type);
  					break;
  				case VML:
  					result = Dom.createElementNS(Dom.NS_VML, type);
  					break;
  			}
  			parent.appendChild(result);
  			return result;
  		} else {
  			return (Element) (parent.getElementsByTagName(type).getItem(0));
  		}
  	}
docs: Create or update a one-of child element in the DOM. Needs no id as it will be created/deleted with the parent.
  
  @param parent the parent element
  @param type the type of the element (tag name, e.g. 'image')
  @return the created or updated element or null if creation failed