rdb: Export RedDot CMS content to Excel
Very often when maintaining sites in RedDot I get to the point when it becomes necessary to change or delete content elements, e.g. the default value of an image, or an entry of an option list, etc.
But doing so on a living project can get you into big trouble if you do not first check the consequences that this action will cause!
So what can we do to get a quick overview of the status of all pages based on a certain content class (that is what we need to get an idea of these consequences)?
The thing I prefer and what I would like to share today is using the Export Instances function, which can be found in the Action Menu at “Administer Content Classes” – (CK folder) – (CK) – “Instances”.
Export your instances
- RedDot displays a dialog where you can enter some search criteria for the export. Though it is possible to enter nothing and to export all instances, you should fill in at least both “Instance ID” fields (from / to).
Attention: The default value for the “max. results” field is set to 50, so set this value appropriately! Do not select “Export all Instances” (even if you exactly want to do this), for this will not work properly.
- Click “Start” and select an export target from the next dialog page. I prefer to export into a local folder on the RedDot server.
- Select all instances and click “OK”.
Every page/instance will be exported as one XML file. These files have the following structure:
<?xml version="1.0" encoding="UTF-8"?>
The type attribute indicates the kind of element (standard field: 1, image: 2, option list: 8, etc.) as documented by RedDot. Some elements may have more attributes (e.g. images).
You will receive an e-mail as soon as the export is finished.
Collect them into one XML file
Open the command prompt (”Start” – “Run…” – enter “cmd”), go to the export folder and run the following code:
C:\Temp> type *.xml > instances.xml
Open this file with a text editor and make it well-formed XML:
- Delete all XML declarations except for the first
- Create an arbitrary root element
- Double check the elements’ content for well-formedness, use CDATA sections if necessary
Regular expression experts can also delete all type=”…” attributes