[opencms-dev] Content Type/ Data import

Hufford, Brian Brian.Hufford at travelocity.com
Tue Oct 11 18:55:03 CEST 2005

there is a way to do an import of data from a legacy db into OpenCms based on your new Xml Content Type. It is sort of a hack, but I was able to get it to work without much trouble. Here is what you do:
1. export your data out of the db as something like a "|" delimited text file
2. write a program that reads this file one line (record) at a time and parses on the "|"
3. have same program take parsed values and create an xml file (for each record) based on your My Article xsd 
4. upload all these xml files using the "file upload applet". They will be uploaded as "plain" type into OpenCms
5. using the Administration console, perform a db export and choose the xml files as the assets to be exported. The exported file will be saved as a ZIP file within your tomcat OpenCms webapp at this location "/webapps/opencms/WEB-INF/packages/yourfile.zip"
6. there should be a manifest.xml in this zip file..open it and do a search/replace for "type=plain" and replace with "type=MyArticle". Then save the modified manifest.xml.
7. using the Administration console, perform a db import (when doing an import you are given a dropdown list of choices of files..your zip file will be one of them). Choose that zip file. That's it...once the db import is finished all the files will be converted to your My Article type.

More information about the opencms-dev mailing list