code: private void toXml(final String indent, final StringBuffer xml) {
  		String primitiveString = formatSimpleValue();
  
  		xml.append(indent);
  		xml.append(isPrimitive() ? "<primitive" : "<object");
  
  		if (refNode == null) {
  			xml.append(" id=\"").append(id).append('"');
  
  			if (fieldName != null) {
  				xml.append(" field=\"").append(fieldName).append('"');
  			}
  
  			if (primitiveString != null) {
  				primitiveString = WebUtilities.encode(primitiveString);
  				xml.append(" value=\"").append(primitiveString).append('"');
  			}
  
  			if (type != null) {
  				xml.append(" type=\"").append(type).append('"');
  			}
  
  			xml.append(" size=\"").append(getSize()).append('"');
  
  			if (getChildCount() == 0) {
  				xml.append("/>\n");
  			} else {
  				xml.append(">\n");
  
  				String newIndent = indent + "  ";
  
  				for (int i = 0; i < getChildCount(); i++) {
  					((ObjectGraphNode) getChildAt(i)).toXml(newIndent, xml);
  				}
  
  				xml.append(indent);
  				xml.append(isPrimitive() ? "</primitive>\n" : "</object>\n");
  			}
  		} else {
  			if (fieldName != null) {
  				xml.append(" field=\"").append(fieldName).append('"');
  			}
  
  			xml.append(" refId=\"").append(refNode.id).append('"');
  
  			if (refNode.value == null) {
  				xml.append(" type=\"").append(refNode.type).append('"');
  			} else {
  				xml.append(" type=\"").append(refNode.value.getClass().getName()).append('"');
  			}
  
  			xml.append(" size=\"").append(OBJREF_SIZE).append('"');
  
  			xml.append("/>\n");
  		}
  	}
docs: Emits an XML representation of this ObjectGraphNode.
  
  @param indent the indent, for formatting.
  @param xml the buffer to write XML output to.