We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
You are here: TWiki> Support Web>XML2TWIKI (27 Apr 2007, HaraldJoerg)
Tags:
import1Add my vote for this tag xml1Add my vote for this tag create new tag
, view all tags

Question

I have a website that is produced from XML... in addition some pages contain links to binary attachments.

I am investigating the possibility of migrating this data to a TWiki instance.

I am fairly experienced when it comes to XML related technologies but have zero background when it comes to perl.

But what I see is that the twiki pages basically exist as text files so there could be a XSL Transform that could take place to change the XML to the txt format twiki requires.

What I am also aware of is that I am guessing that various other updates would be required to other text files that store information on the website.

What I am looking for are tips on what parts of the website would require updating if trying to perform this.

I hope the info I have provided is clear if not please let me know.... thanks

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Windows XP
Web server: Apache 1.3
Perl version: 5.7
Client OS: XP
Web Browser: IE6
Categories: Installation

-- TWikiGuest - 26 Apr 2007

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

If I understand you correctly then you want to make a "once-and-forever" migration. This should be really straightforward, without any need for Perl knowledge. It is just a matter of whether you want any "fine tuning" around the edges.

  • If you want to put your XML sourced files into a separate web, create that web first with TWiki's own function (see TWiki.ManagingWebs). This will create all the "management topics" (WebHome, WebPreferences) for you. You could later even overwrite your WebHome.txt file if your XML process produces its own "homepage".
  • Let your XSLT process produce text output, and take special care for spaces and linefeeds: TWiki's text files are line oriented, and newlines within lists or tables can spoil things. Lists have to start with exactly 3*n spaces.
  • Take care for "consistent" encoding between your XSLT output declaration and your TWiki configuration.
  • You do not have to update anything beyond the .txt files for a start. Things like the index or searches are done in "real time" and will work immediately.
  • Attachments can be migrated directly by moving them to the appropriate pub directory. Probably you'll have to create the directories in advance. Take any example .txt file with an attachment to examine how they are linked.
  • Take care for file permissions: For TWiki operation, all .txt files and attachments, and their directories, must be writeable by the user id of Apache.
  • Make sure that all .txt files start with an uppercase letter.

With this procedure, TWiki users should be able to view, and to edit, the files right from the start. After the first edit the RCS history file (extension .txt,v) will be created automatically by TWiki; that's why the directory must be writeable by Apache. The missing features are (maybe the list is incomplete):

  • Neither the text files nor the attachments have a "history", of course. If you want you can create that by checking the files in with the appropriate RCS command, like TWiki does.
  • There is no mail notification for your initial file creation. This would be a problem only if you regularly add or change files with your XML process, but not for a one-shot migration.

-- HaraldJoerg - 26 Apr 2007

If you create a generic solution we'd love to see a XmlToTWikiAddOn or XmlToTWikiPlugin posted in the Plugins web on twiki.org.

See also Tag:import and Tag:xml.

-- PeterThoeny - 26 Apr 2007

A generic solution would be too difficult, since the transformations heavily depend on the source schema. I am not sure whether there are sufficiently popular ones around. Docbook comes into my mind, which would give a hell of a stylesheet, or XHTML, accompanied by all the problems known from the Wysiwyg HTML to TML roundtrips. There are plugins which do XML conversion "on the fly" (SablotronPlugin and XmlXslPlugin), but neither is suitable if you have an actual migration with a possibility for subsequent TWiki editing in mind.

The best I could think of is to create named (i.e. callable) =<xsl:template...> elements which serve to convert contents passed as parameters to TML snippets, e.g. for internal links in brackets (especially when chunking), lists, tables, attachment specifications, and so on.

-- HaraldJoerg - 27 Apr 2007

 
Change status to:
Topic revision: r4 - 27 Apr 2007 - 20:38:14 - HaraldJoerg
 
TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback