void write(XmlWriter writer, AddressSetView set, TaskMonitor monitor)
			throws CancelledException {
		if (set == null) {
			set = program.getMemory();
		}

		writer.startElement("MARKUP");

		monitor.setMessage("Exporting References...");
		AddressIterator iter = refManager.getReferenceSourceIterator(set, true);
		while (iter.hasNext()) {
			Reference[] refs = refManager.getReferencesFrom(iter.next());
			for (int i = 0; i < refs.length; i++) {
				if (monitor.isCancelled()) {
					throw new CancelledException();
				}
				Reference ref = refs[i];
				if (ref.isMemoryReference()) {
					writeMemoryReference(ref, writer);
				}
			}
		}

		iter = refManager.getReferenceSourceIterator(set, true);
		while (iter.hasNext()) {
			Reference[] refs = refManager.getReferencesFrom(iter.next());
			for (int i = 0; i < refs.length; i++) {
				if (monitor.isCancelled()) {
					throw new CancelledException();
				}
				Reference ref = refs[i];
				if (ref.isStackReference()) {
					writeStackReference((StackReference) ref, writer);
				}
			}
		}

		iter = refManager.getReferenceSourceIterator(set, true);
		while (iter.hasNext()) {
			Reference[] refs = refManager.getReferencesFrom(iter.next());
			for (int i = 0; i < refs.length; i++) {
				if (monitor.isCancelled()) {
					throw new CancelledException();
				}
				Reference ref = refs[i];
				if (ref.isExternalReference()) {
					writeExternalReference((ExternalReference) ref, writer);
				}
			}
		}

		writeEquateReferences(writer, set, monitor);

		writer.endElement("MARKUP");
	}
@param element
@param language
@param overwrite
Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/MarkupXmlMgr.java