private void writeMemoryReference(Reference ref, XmlWriter writer) {

		if (ref.getSource() == SourceType.USER_DEFINED) {
			XmlAttributes attr = new XmlAttributes();
			addCommonRefAttributes(attr, ref);
			attr.addAttribute("TO_ADDRESS", XmlProgramUtilities.toString(ref.getToAddress()));
			if (ref.isOffsetReference()) {
				attr.addAttribute("BASE_ADDRESS",
					XmlProgramUtilities.toString(((OffsetReference) ref).getBaseAddress()));
			}
			else if (ref.isShiftedReference()) {

// TODO: Handle ShiftedReference

			}
			attr.addAttribute("PRIMARY", ref.isPrimary());
			writer.writeElement("MEMORY_REFERENCE", attr);
		}
	}
@param element
@param language
@param overwrite
Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/MarkupXmlMgr.java