private void processMemoryReference(XmlElement element, boolean overwrite) {
		try {
			String fromAddrStr = element.getAttribute("ADDRESS");
			if (fromAddrStr == null) {
				throw new XmlAttributeException(
					"ADDRESS attribute missing for MEMORY_REFERENCE element");
			}
			Address fromAddr = XmlProgramUtilities.parseAddress(factory, fromAddrStr);
			if (fromAddr == null) {
				throw new AddressFormatException(
					"Incompatible Memory Reference FROM Address: " + fromAddrStr);
			}

			String toAddrStr = element.getAttribute("TO_ADDRESS");
			if (toAddrStr == null) {
				throw new XmlAttributeException(
					"TO_ADDRESS attribute missing for MEMORY_REFERENCE element");
			}
			Address toAddr = XmlProgramUtilities.parseAddress(factory, toAddrStr);
			if (toAddr == null) {
				throw new AddressFormatException(
					"Incompatible Memory Reference TO Address: " + toAddrStr);
			}

			int opIndex = CodeUnit.MNEMONIC;
			if (element.hasAttribute("OPERAND_INDEX")) {
				opIndex = XmlUtilities.parseInt(element.getAttribute("OPERAND_INDEX"));
				if (opIndex < 0) {
					throw new XmlAttributeException(
						"Illegal OPERAND_INDEX value [" + opIndex + "]");
				}
			}

			boolean userDefined = true;
			if (element.hasAttribute("USER_DEFINED")) {
				userDefined = XmlUtilities.parseBoolean(element.getAttribute("USER_DEFINED"));
			}

			boolean primary = false;
			if (element.hasAttribute("PRIMARY")) {
				primary = XmlUtilities.parseBoolean(element.getAttribute("PRIMARY"));
			}

			Address baseAddr = null;
			if (element.hasAttribute("BASE_ADDRESS")) {
				baseAddr =
					XmlProgramUtilities.parseAddress(factory, element.getAttribute("BASE_ADDRESS"));
			}

			if (!overwrite) {
				Reference existingMemRef = refManager.getReference(fromAddr, toAddr, opIndex);
				if (existingMemRef != null) {
					log.appendMsg("Memory reference already existed from [" + fromAddr + "] to [" +
						toAddr + "] on operand [" + opIndex + "]");
					return;
				}
			}

			RefType refType = getDefaultRefType(fromAddr, toAddr, opIndex);

			Command<Program> cmd = null;
			if (baseAddr != null) {
				long offset = toAddr.subtract(baseAddr);
				cmd = new AddOffsetMemRefCmd(fromAddr, toAddr, false, refType,
					userDefined ? SourceType.USER_DEFINED : SourceType.DEFAULT, opIndex, offset);
			}
			else {
				cmd = new AddMemRefCmd(fromAddr, toAddr, refType,
					userDefined ? SourceType.USER_DEFINED : SourceType.DEFAULT, opIndex);
			}

			cmd.applyTo(program);

			cmd = new SetPrimaryRefCmd(fromAddr, opIndex, toAddr, primary);
			cmd.applyTo(program);

		}
		catch (Exception e) {
			log.appendException(e);
		}
	}
@param element
@param language
@param overwrite
Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/MarkupXmlMgr.java