Java Code Examples for org.jdom.Element#setText()

The following examples show how to use org.jdom.Element#setText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WidgetTypeDOM.java    From entando-core with GNU Lesser General Public License v3.0 6 votes vote down vote up
public WidgetTypeDOM(List<WidgetTypeParameter> parameters, String action) throws ApsSystemException {
	this.setDoc(new Document());
	Element root = new Element("config");
	if (null != parameters && parameters.size() > 0) {
		for (int i = 0; i < parameters.size(); i++) {
			WidgetTypeParameter parameter = parameters.get(i);
			Element paramElement = new Element(TAB_PARAMETER);
			paramElement.setAttribute("name", parameter.getName());
			if (null != parameter.getDescr()) {
				paramElement.setText(parameter.getDescr());
			}
			root.addContent(paramElement);
		}
	}
	if (null != action) {
		Element actionElement = new Element(TAB_ACTION);
		actionElement.setAttribute("name", action);
		root.addContent(actionElement);
	}
	this.getDoc().setRootElement(root);
}
 
Example 2
Source File: XMLProperties.java    From jivejdon with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the value of the specified property. If the property doesn't
 * currently exist, it will be automatically created.
 * 
 * @param name
 *            the name of the property to set.
 * @param value
 *            the new value for the property.
 */
public void setProperty(String name, String value) {
	// Set cache correctly with prop name and value.
	propertyCache.put(name, value);

	String[] propName = parsePropertyName(name);
	// Search for this property by traversing down the XML heirarchy.
	Element element = doc.getRootElement();
	for (int i = 0; i < propName.length; i++) {
		// If we don't find this part of the property in the XML heirarchy
		// we add it as a new node
		if (element.getChild(propName[i]) == null) {
			element.addContent(new Element(propName[i]));
		}
		element = element.getChild(propName[i]);
	}
	// Set the value of the property in this node.
	element.setText(value);

}
 
Example 3
Source File: SeoPageExtraConfigDOM.java    From entando-components with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected void fillDocument(Document doc, PageMetadata pageMetadata) {
    super.fillDocument(doc, pageMetadata);
    if (!(pageMetadata instanceof SeoPageMetadata)) {
        return;
    }
    SeoPageMetadata seoPageMetadata = (SeoPageMetadata) pageMetadata;
    Element useExtraDescriptionsElement = new Element(USE_EXTRA_DESCRIPTIONS_ELEMENT_NAME);
    useExtraDescriptionsElement.setText(String.valueOf(seoPageMetadata.isUseExtraDescriptions()));
    doc.getRootElement().addContent(useExtraDescriptionsElement);
    ApsProperties descriptions = seoPageMetadata.getDescriptions();
    this.fillMultilangProperty(descriptions, doc.getRootElement(), DESCRIPTIONS_ELEMENT_NAME);
    ApsProperties keywords = seoPageMetadata.getKeywords();
    this.fillMultilangProperty(keywords, doc.getRootElement(), KEYWORDS_ELEMENT_NAME);
    if (null != seoPageMetadata.getFriendlyCode() && seoPageMetadata.getFriendlyCode().trim().length() > 0) {
        Element friendlyCodeElement = new Element(FRIENDLY_CODE_ELEMENT_NAME);
        friendlyCodeElement.setText(seoPageMetadata.getFriendlyCode().trim());
        doc.getRootElement().addContent(friendlyCodeElement);
    }
    if (null != seoPageMetadata.getComplexParameters()) {
        Element complexConfigElement = new Element(COMPLEX_PARAMS_ELEMENT_NAME);
        this.addComplexParameters(complexConfigElement, seoPageMetadata.getComplexParameters());
        doc.getRootElement().addContent(complexConfigElement);
    }
}
 
Example 4
Source File: EnumeratorMapAttribute.java    From entando-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Element getJDOMElement() {
    Element rootElement = this.createRootElement("attribute");
    if (StringUtils.isNotEmpty(this.getMapKey())) {
        Element keyElement = new Element("key");
        keyElement.setText(this.getMapKey().trim());
        rootElement.addContent(keyElement);
        Element valueElement = new Element("value");
        if (StringUtils.isNotEmpty(this.getMapValue())) {
            valueElement.setText(this.getMapValue().trim());
        }
        rootElement.addContent(valueElement);
    }
    return rootElement;
}
 
Example 5
Source File: MailConfigDOM.java    From entando-components with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Extract the smtp configuration from the xml element and save it into the MailConfig object.
 * @param root The xml root element containing the smtp configuration.
 * @param config The configuration.
 */
private Element createConfigElement(MailConfig config) {
	Element configElem = new Element(ROOT);
	Element activeElement = new Element(ACTIVE_ELEM);
	activeElement.setText(String.valueOf(config.isActive()));
	configElem.addContent(activeElement);
	Element sendersElem = this.createSendersElement(config);
	configElem.addContent(sendersElem);
	Element smtpElem = this.createSmtpElement(config);
	configElem.addContent(smtpElem);
	return configElem;
}
 
Example 6
Source File: SequencerModel.java    From olat with Apache License 2.0 5 votes vote down vote up
/**
 * Method to add a new item (or update an existing item) to the navigation file - used to persist package status
 * 
 * @param itemId
 * @param orgId
 * @param value
 */
public void addTrackedItem(final String itemId, final String orgId, final String value) {
    boolean itemFound = false;

    // check to see if the item is there already, if so reset it
    final List itemList = getDocument().getRootElement().getChildren(ITEM_NODE);
    if (itemList != null && !itemList.isEmpty()) {
        final Iterator itemListElement = itemList.iterator();
        while (itemListElement.hasNext()) {
            final Element anItem = (Element) itemListElement.next();
            if (anItem.getAttributeValue(ITEM_IDENTIFIER).equals(itemId)) {
                anItem.setText(value);
                _items.add(itemId);
                itemFound = true;
            }
        }
    }
    // otherwise add it as a new node.
    if (itemFound == false) {
        final Element node = new Element(ITEM_NODE);
        node.setText(value);
        node.setAttribute(ITEM_IDENTIFIER, itemId);
        node.setAttribute(ORG_NODE, orgId);
        getDocument().getRootElement().addContent(node);
        _items.add(itemId);
    }

}
 
Example 7
Source File: AttachedSourceJarManager.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public Element getState() {
  Element element = new Element("state");
  Set<LibraryKey> copy;
  synchronized (librariesWithSourceJarsAttached) {
    copy = ImmutableSet.copyOf(librariesWithSourceJarsAttached);
  }
  for (LibraryKey libraryKey : copy) {
    Element libElement = new Element("library");
    libElement.setText(libraryKey.getIntelliJLibraryName());
    element.addContent(libElement);
  }
  return element;
}
 
Example 8
Source File: LangDOM.java    From entando-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void addLang(Lang lang) {
	Element langElement = new Element("Lang");
	Element codeElement = new Element("code");
	codeElement.setText(lang.getCode());
	langElement.addContent(codeElement);
	Element descrElement = new Element("descr");
	descrElement.setText(lang.getDescr());
	langElement.addContent(descrElement);
	if (lang.isDefault()) {
		Element defaultElement = new Element("default");
		defaultElement.setText(new Boolean(lang.isDefault()).toString());
		langElement.addContent(defaultElement);
	}
	this.doc.getRootElement().addContent(langElement);
}
 
Example 9
Source File: PageModelDOM.java    From entando-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
public PageModelDOM(PageModel pageModel) throws ApsSystemException {
	this._doc = new Document();
	Element root = new Element("frames");
	this._doc.setRootElement(root);
	Frame[] frames = pageModel.getConfiguration();
	for (int i = 0; i < frames.length; i++) {
		Frame frame = frames[i];
		Element frameElement = new Element(TAB_FRAME);
		frameElement.setAttribute(ATTRIBUTE_POS, String.valueOf(i));
		if (frame.isMainFrame()) {
			frameElement.setAttribute(ATTRIBUTE_MAIN, "true");
		}
		Element descrElement = new Element(TAB_DESCR);
		descrElement.setText(frame.getDescription());
		frameElement.addContent(descrElement);
		
		Element sketchElement = this.buildSketchXML(frame);
		if (null != sketchElement) {
			frameElement.addContent(sketchElement);
		}
		
		Widget defaultWidget = frame.getDefaultWidget();
		if (null != defaultWidget) {
			Element defaultWidgetElement = new Element(TAB_DEFAULT_WIDGET);
			defaultWidgetElement.setAttribute(ATTRIBUTE_CODE, defaultWidget.getType().getCode());
			ApsProperties properties = defaultWidget.getConfig();
			if (null != properties && !properties.isEmpty()) {
				ApsPropertiesDOM propertiesDom = new ApsPropertiesDOM();
				propertiesDom.buildJDOM(properties);
				Element widgetConfigElement = propertiesDom.getRootElement();
				defaultWidgetElement.addContent(widgetConfigElement);
			}
			frameElement.addContent(defaultWidgetElement);
		}
		root.addContent(frameElement);
	}
}
 
Example 10
Source File: SequencerModel.java    From olat with Apache License 2.0 5 votes vote down vote up
/**
 * @param lastModified
 */
public void setManifestModifiedDate(final long lastModified) {
    final Element root = getDocument().getRootElement();
    if (root.getChild(MANIFEST_MODIFIED) == null) {
        final Element time = new Element(MANIFEST_MODIFIED);
        time.setText(Long.toString(lastModified));
        root.addContent(time);
    } else {
        root.getChild(MANIFEST_MODIFIED).setText(Long.toString(lastModified));
    }
}
 
Example 11
Source File: TestResourceReference.java    From gate-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Document getCreoleXML() throws Exception, JDOMException {
  Document doc = new Document();
  Element element;
  doc.addContent(element = new Element("CREOLE-DIRECTORY"));

  element.addContent(element = new Element("CREOLE"));
  element.addContent(element = new Element("RESOURCE"));
  Element classElement = new Element("CLASS");
  classElement.setText(TestResource.class.getName());
  element.addContent(classElement);
  return doc;
}
 
Example 12
Source File: RunConfigurationFlagsState.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public void writeExternal(Element element) {
  element.removeChildren(tag);
  for (String flag : flags) {
    Element child = new Element(tag);
    child.setText(flag);
    element.addContent(child);
  }
}
 
Example 13
Source File: DocumentElement.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
public void setHint(String hint){
	Element eHint = new Element(ELEMENT_HINT, getContainer().getNamespace());
	eHint.setText(hint);
	getElement().addContent(eHint);
}
 
Example 14
Source File: ConsultationExport.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
public String doExport(String dir, String stickerName){
	try {
		Query<Patient> qbe = new Query<Patient>(Patient.class);
		if (stickerName != null) {
			List<Sticker> ls =
				new Query<Sticker>(Sticker.class, Sticker.FLD_NAME, stickerName).execute();
			if (ls != null && ls.size() > 0) {
				final Sticker sticker = ls.get(0);
				
				final PatFilterImpl pf = new PatFilterImpl();
				IFilter flt = new IFilter() {
					@Override
					public boolean select(Object element){
						return pf.accept((Patient) element, sticker) == IPatFilter.ACCEPT;
					}
					
				};
				qbe.addPostQueryFilter(flt);
			} else {
				return "Sticker " + stickerName + " nicht gefunden.";
			}
		}
		for (Patient pat : qbe.execute()) {
			Element e = new Element("Patient");
			e.setAttribute("ID", pat.getId());
			e.setAttribute("Name", pat.get(Patient.FLD_NAME));
			e.setAttribute("Vorname", pat.get(Patient.FLD_FIRSTNAME));
			e.setAttribute("GebDat", pat.get(Patient.FLD_DOB));
			for (Fall fall : pat.getFaelle()) {
				Element f = new Element("Fall");
				e.addContent(f);
				f.setAttribute("ID", fall.getId());
				f.setAttribute("Bezeichnung", fall.getBezeichnung());
				f.setAttribute("BeginnDatum", fall.getBeginnDatum());
				f.setAttribute("EndDatum", fall.getEndDatum());
				f.setAttribute("Gesetz", fall.getConfiguredBillingSystemLaw().name());
				f.setAttribute("Abrechnungssystem", fall.getAbrechnungsSystem());
				Kontakt k = fall.getGarant();
				if (k != null) {
					f.setAttribute("Garant", fall.getGarant().getLabel());
				}
				Kontakt costBearer = fall.getCostBearer();
				if (costBearer != null) {
					f.setAttribute("Kostentraeger", costBearer.getLabel());
					f.setAttribute("Versicherungsnummer",
						fall.getRequiredString("Versicherungsnummer"));
				}
				for (Konsultation kons : fall.getBehandlungen(false)) {
					Element kel = new Element("Konsultation");
					f.addContent(kel);
					kel.setAttribute("ID", kons.getId());
					kel.setAttribute("Datum", kons.getDatum());
					kel.setAttribute("Label", kons.getVerboseLabel());
					Samdas samdas = new Samdas(kons.getEintrag().getHead());
					kel.setText(samdas.getRecordText());
				}
			}
			Document doc = new Document();
			doc.setRootElement(e);
			FileOutputStream fout = new FileOutputStream(new File(dir, pat.getId() + ".xml"));
			OutputStreamWriter cout = new OutputStreamWriter(fout, "UTF-8"); //$NON-NLS-1$
			XMLOutputter xout = new XMLOutputter(Format.getPrettyFormat());
			xout.output(doc, cout);
			cout.close();
			fout.close();
		}
		return "ok";
	} catch (Exception ex) {
		return ex.getClass().getName() + ":" + ex.getMessage();
	}
}
 
Example 15
Source File: DataSourceDumpReport.java    From entando-core with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void addElement(String name, String text, Element parent) {
	Element element = new Element(name);
	element.setText(text);
	parent.addContent(element);
}
 
Example 16
Source File: AddRetrospectiveToSprint.java    From ezScrum with GNU General Public License v2.0 4 votes vote down vote up
private void addRetrospectiveToSprint(IProject iproject, ArrayList<Long> list, String sprintID) {
		// ProductBacklog pb = new ProductBacklog(p, config.getUserSession());
		ProjectObject project = new ProjectObject(iproject.getName());
		ProductBacklogMapper productBacklogMapper = new ProductBacklogMapper(project);
		
		for (long issueID : list) {
//			IIssue issue = pb.getIssue(issueID);
			IIssue issue = productBacklogMapper.getIssue(issueID);
			String oldSprintID = issue.getSprintID();
			if (sprintID != null && !sprintID.equals("")
					&& Integer.parseInt(sprintID) >= 0) {

				// history node
				Element history = new Element(ScrumEnum.HISTORY_TAG);

				Date current = new Date();
				String dateTime = DateUtil.format(current,
						DateUtil._16DIGIT_DATE_TIME_2);
				// history.setAttribute(IIssue.TYPE_HISTORY_ATTR,
				// IIssue.STORY_TYPE_HSITORY_VALUE);
				history.setAttribute(ScrumEnum.ID_HISTORY_ATTR, dateTime);

				// iteration node
				Element iteration = new Element(ScrumEnum.SPRINT_ID);
				iteration.setText(sprintID);
				history.addContent(iteration);
				issue.addTagValue(history);

				// 最後將修改的結果更新至DB
//				pb.updateTagValue(issue);
//				pb.addHistory(issue.getIssueID(), ScrumEnum.SPRINT_TAG, oldSprintID, sprintID);
				// 將Stroy與Srpint對應的關係增加到StoryRelationTable
//				pb.updateStoryRelation(Long.toString(issueID), issue
//						.getReleaseID(), sprintID, null, null, current);
				
				// 最後將修改的結果更新至DB
				productBacklogMapper.updateIssueValue(issue, true);
				productBacklogMapper.addHistory(issue.getIssueID(), issue.getIssueType(), HistoryObject.TYPE_APPEND, oldSprintID, sprintID);
				// 將Stroy與Srpint對應的關係增加到StoryRelationTable
				productBacklogMapper.updateStoryRelation(issueID, issue.getReleaseID(), sprintID, null, null, current);
			}
		}
	}
 
Example 17
Source File: ScoDocument.java    From olat with Apache License 2.0 4 votes vote down vote up
/**
 * createNewInteraction() - Creates a new <interaction> element structure in the xml CMI datamodel for a particular sco.
 * 
 * @param index
 *            - the index for the <interaction> to be created
 * @param noOfObjectives
 *            - the number of objective nodes to create
 * @param noOfCorrectResponses
 *            - the number of correct_responses nodes to create
 */
private void createNewInteraction(final int index, final int noOfObjectives, final int noOfCorrectResponses) {
    // first get hold of the <interactions> node
    final Element ints = getElement(getDocument().getRootElement(), "cmi.interactions");
    // and then add our <interaction index=""> node
    final Element interaction = new Element("interaction");
    interaction.setAttribute("index", index + "");
    ints.addContent(interaction);
    // add <id>
    final Element id = new Element("id");
    interaction.addContent(id);

    // add <objectives>
    final Element objectives = new Element("objectives");
    interaction.addContent(objectives);
    // add <_count> to <objectives>
    final Element _count = new Element("_count");
    _count.setText(noOfObjectives + "");
    objectives.addContent(_count);

    // add all the objectives needed
    for (int i = 0; i < noOfObjectives; i++) {
        final Element objectiveItem = new Element("objective");
        objectiveItem.setAttribute("index", i + "");
        final Element objID = new Element("id");
        objectiveItem.addContent(objID);
        // now add this lot to the <objectives> node
        objectives.addContent(objectiveItem);
    }

    // add <time>
    final Element time = new Element("time");
    interaction.addContent(time);
    // add <type>
    final Element type = new Element("type");
    interaction.addContent(type);

    // add <correct_responses>
    final Element correct_responses = new Element("correct_responses");
    interaction.addContent(correct_responses);
    // add <_count> to <correct_responses>
    final Element _countCR = new Element("_count");
    _countCR.setText(noOfCorrectResponses + "");
    correct_responses.addContent(_countCR);

    // add all the correct_responses needed
    for (int i = 0; i < noOfCorrectResponses; i++) {
        final Element correctResponseItem = new Element("correct_response");
        correctResponseItem.setAttribute("index", i + "");
        final Element pattern = new Element("pattern");
        correctResponseItem.addContent(pattern);
        // now add this lot to the <correct_responses> node
        correct_responses.addContent(correctResponseItem);
    }

    // add <weighting>
    final Element weighting = new Element("weighting");
    interaction.addContent(weighting);
    // add <student_response>
    final Element student_response = new Element("student_response");
    interaction.addContent(student_response);
    // add <result>
    final Element result = new Element("result");
    interaction.addContent(result);
    // add <latency>
    final Element latency = new Element("latency");
    interaction.addContent(latency);
}
 
Example 18
Source File: MantisIssueServiceTest.java    From ezScrum with GNU General Public License v2.0 4 votes vote down vote up
private void addTagElement(IIssue issue, String imp, String est, String value, String howtodemo, String notes) {
	Element history = new Element(ScrumEnum.HISTORY_TAG);
	history.setAttribute(ScrumEnum.ID_HISTORY_ATTR, DateUtil.format(new Date(), DateUtil._16DIGIT_DATE_TIME_2));

	if (imp != null && !imp.equals("")) {
		Element importanceElem = new Element(ScrumEnum.IMPORTANCE);
		int temp = (int) Float.parseFloat(imp);
		importanceElem.setText(temp + "");
		history.addContent(importanceElem);
	}

	if (est != null && !est.equals("")) {
		Element storyPoint = new Element(ScrumEnum.ESTIMATION);
		storyPoint.setText(est);
		history.addContent(storyPoint);
	}
	
	if(value != null && !value.equals("")) {
		Element customValue = new Element(ScrumEnum.VALUE);
		customValue.setText(value);
		history.addContent(customValue);
	}
	
	Element howToDemoElem = new Element(ScrumEnum.HOWTODEMO);
	howToDemoElem.setText(howtodemo);
	history.addContent(howToDemoElem);

	Element notesElem = new Element(ScrumEnum.NOTES);
	notesElem.setText(notes);
	history.addContent(notesElem);
	
	if (history.getChildren().size() > 0) {
		issue.addTagValue(history);
		mMantisService.updateBugNote(issue);
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
 
Example 19
Source File: MantisService.java    From ezScrum with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void resetStatusToNew(long issueId, String name, String bugNote,
		Date resetDate) {
	IIssue issue = getIssue(issueId);
	int oldStatus = issue.getStatusValue();

	// String updateQuery = "UPDATE `mantis_bug_table` SET `status` = '"
	// + ITSEnum.NEW_STATUS + "', `resolution` = '"
	// + ITSEnum.OPEN_RESOLUTION
	// + "', `handler_id` = '0' WHERE `mantis_bug_table`.`id` ="
	// + issueID;
	TranslateSpecialChar translateChar = new TranslateSpecialChar();// accept
																	// special
																	// char
																	// ex: /
																	// '
	name = translateChar.TranslateDBChar(name);

	IQueryValueSet valueSet = new MySQLQuerySet();
	valueSet.addTableName("mantis_bug_table");
	valueSet.addInsertValue("summary", name);
	valueSet.addInsertValue("status", Integer.toString(ITSEnum.NEW_STATUS));
	valueSet.addInsertValue("resolution",
			Integer.toString(ITSEnum.OPEN_RESOLUTION));
	valueSet.addInsertValue("handler_id", "0");
	valueSet.addEqualCondition("id", Long.toString(issueId));
	String query = valueSet.getUpdateQuery();

	getControl().execute(query);

	// 新增歷史記錄,還有一個 resolution 的 history ,因為不是很重要,就暫時沒加入
	HistoryObject statusHistory = new HistoryObject(
			issue.getIssueID(), 
			issue.getIssueType(), 
			HistoryObject.TYPE_STATUS,
			String.valueOf(oldStatus),
			String.valueOf(ITSEnum.NEW_STATUS),
			resetDate.getTime());
	statusHistory.save();
	if (bugNote != null && !bugNote.equals("")) {
		Element history = new Element(ScrumEnum.HISTORY_TAG);
		history.setAttribute(ScrumEnum.ID_HISTORY_ATTR,
				DateUtil.format(new Date(), DateUtil._16DIGIT_DATE_TIME_2));

		Element notesElem = new Element(ScrumEnum.NOTES);
		notesElem.setText(bugNote);
		history.addContent(notesElem);

		if (history.getChildren().size() > 0) {
			issue.addTagValue(history);
			// 最後將修改的結果更新至DB
			updateBugNote(issue);
		}
	}
}
 
Example 20
Source File: GenerateOldLanguagePlugin.java    From ghidra with Apache License 2.0 4 votes vote down vote up
private void buildDefaultTranslator(Language newLang, File transFile) throws IOException {

			DummyLanguageTranslator defaultTrans = new DummyLanguageTranslator(oldLang, newLang);
			if (!defaultTrans.isValid()) {
				throw new AssertException();
			}

			Element root = new Element("language_translation");

			Element fromLang = new Element("from_language");
			fromLang.setAttribute("version", Integer.toString(oldLang.getVersion()));
			fromLang.setText(oldLang.getLanguageID().getIdAsString());
			root.addContent(fromLang);

			Element toLang = new Element("to_language");
			toLang.setAttribute("version", Integer.toString(newLang.getVersion()));
			toLang.setText(newLang.getLanguageID().getIdAsString());
			root.addContent(toLang);

			for (CompilerSpecDescription oldCompilerSpecDescription : oldLang.getCompatibleCompilerSpecDescriptions()) {
				CompilerSpecID oldCompilerSpecID = oldCompilerSpecDescription.getCompilerSpecID();
				String newId;
				try {
					newId =
						newLang.getCompilerSpecByID(oldCompilerSpecID).getCompilerSpecID().getIdAsString();
				}
				catch (CompilerSpecNotFoundException e) {
					newId = newLang.getDefaultCompilerSpec().getCompilerSpecID().getIdAsString();
				}
				Element compilerSpecMapElement = new Element("map_compiler_spec");
				compilerSpecMapElement.setAttribute("from", oldCompilerSpecID.getIdAsString());
				compilerSpecMapElement.setAttribute("to", newId);
				root.addContent(compilerSpecMapElement);
			}

			if (!defaultTrans.canMapSpaces) {
				for (AddressSpace space : oldLang.getAddressFactory().getPhysicalSpaces()) {
					Element mapSpaceElement = new Element("map_space");
					mapSpaceElement.setAttribute("from", space.getName());
					mapSpaceElement.setAttribute("to", "?" + space.getSize());
					root.addContent(mapSpaceElement);
				}
			}

			for (Register reg : oldLang.getRegisters()) {
				Register newReg = defaultTrans.getNewRegister(reg);
				if (newReg == null) {
					Element mapRegElement = new Element("map_register");
					mapRegElement.setAttribute("from", reg.getName());
					mapRegElement.setAttribute("to", ("?" + reg.getMinimumByteSize()));
					mapRegElement.setAttribute("size", Integer.toString(reg.getMinimumByteSize()));
					root.addContent(mapRegElement);
				}
			}

			Document doc = new Document(root);
			FileOutputStream out = new FileOutputStream(transFile);
			XMLOutputter xml = new GenericXMLOutputter();
			xml.output(doc, out);
			out.close();

			Register oldCtx = oldLang.getContextBaseRegister();
			Register newCtx = newLang.getContextBaseRegister();
			boolean contextWarning = false;
			if (oldCtx != null && defaultTrans.isValueTranslationRequired(oldCtx)) {
				contextWarning = true;
			}
			else if (oldCtx == null && newCtx != null) {
				contextWarning = true;
			}
			if (contextWarning) {
				Msg.showWarn(getClass(), tool.getToolFrame(), "Translator Warning",
					"The new context register differs from the old context!\n"
						+ "A set_context element or custom translator may be required.");
			}
		}