I'm new here

Re-Import XML data into FS fields in one go?


before I go the long way, I'd lke to ask the community whether there is a shorter / more generic / elegant solution to the following problem:

  • Field values are exported via the EditorValue.get(language).toXml() method and saved into a XML file (example below)
  • The language-specific field values are then translated externally, leaving the structure intact.
  • The XML file is the parsed back into FS, resulting in a DOM document or alternatively in an XML string

Here are examples for the resulting XML data

CMS_INPUT_TEXT(AREA) (Data value type is String)

<LANG id="DE" set="1"><TEXT>Start page</TEXT></LANG>
CMS_INPUT_DOM (Data value type is DomElement)
<LANG id="DE" set="1"><DOM><p>This is DOM Text <CMS_LINK linktemplate="linkconf00" type="genericLink"><TEMPLATECONTENT><CMS_VALUE name="lt_text_2"><LANG id="§" set="0"/></CMS_VALUE><CMS_VALUE name="lt_text_1"><LANG id="§" set="1"><TEXT>more</TEXT></LANG>

The "long" way would be to parse the XML structures, and serve the respective interfaces of the different Editor types, but that seems absolutely absurd when you consider that the XML structure is exactly the one that FS uses and outputs via toXml. So is there a field-unspecific way (like the deprecated Editor.setValue(Language language, Object value) to do this with the given information?

  • The XML structure above as DOM nodes or String
  • The Type of the target Editor, e.g. from the API function getValueType()
  • Maybe the data from the source language

Any input is much appreciated!

Arndt Bär

0 Kudos
1 Reply
Crownpeak employee

I suggest to use a FirstSpirit module [from e-Spirit], which exports and imports the data as XML.

Just ask your e-Spirit account manager (Frank Marasek), since the module is not yet completely released.

0 Kudos