THL Toolbox > Essays > Creating an XML Essay for THDL > Old Instructions on Converting Word to XML
The conversion routine is written in Visual Basic for Applications and is included within a word document, called “Text to XML Converter.doc”. It will only work on Windows machines. It is necessary to obtain this file and a few other supplementary ones for the conversion to run successfully. To set up one’s machine properly for conversion, do the following:
- Download the text2XML.zip package from THL website.
- Upzip it.
- Place the file called teiHeader.dat in the C:xml folder that is already on your hard drive from having set up Morphon.
- Save the other documents in a convenient folder anywhere on your hard drive. These other files are:
- TextToXMLConverter.doc – the actual document that does the converting
- metatable.doc – contains the metadata table that must be placed at the very topo of any document before conversion.
- THL Word to XML Manual.doc – the instructions for how to apply the styles to a particular document.
With these documents in place, one can next proceed to actually convert a Word document into an XML document.
Once the above documents are in hand and in their proper places, you can proceed with the process of actually converting a Microsoft Word document into an XML file. This, of course, assumes that the text to be marked up has already been entered into Word, proofed and so forth. From that point, the conversion process is as follows:
- Using the THL “Word to XML” style template, styles should be applied to the appropriate parts of the document, as detailed in our Word to XML Conversion page.
- The whole essay is then copied and pasted into the THL TextToXMLConverter.doc.
- Make sure macros are enabled by going to Tools (menu), choosing Macro, and then Security. (It should be set to medium or low. If it is set to high, you must change the setting. Close and reopen the document).
- If the document does not already have the metadata table at the top, add this at the very top of the document and fill it out the appropriate fields.
- Press Alt-Shift i. This will start the macro that reviews all italics outside of headers. The resulting window will show an italicized word and give a drop down menu of types. Choose the appropriate type and press enter. The next italicized phrase will appear. In this way, it will proceed through the document assigning specific character styles to replace italics that are generically used for titles, foreign words, and so forth.
- Press Ctrl-Alt c. This will start the conversion routine. When it is finished, an alert window will pop-up telling you to cut and paste the document into your XML editor.
- In Morphon, choose File, New. In the file-chooser that pops up, press the “New” button.
- A Input Box will appear with the label “Enter a root element”. To create a blank document, enter anything, such as “Blank”, “temp”, “bogus”.
- In the resulting document, choose View, Source. (Ctrl u)
- Delete everything in the source view.
- Cut an paste the converted XML document from Word into Morphon.
- Click on the green check-mark icon in the taskbar below the menus to validate the document
- Because the conversion routine is imperfect, validation errors will inevitably occur. Only one error appears at a time. Check the line number. Go to that place in the document and fix the error. Check validation again (green check-mark). Repeat as necessary.
- When you receive the message, “Your document is valid!”. Choose View, Inline Tags (Ctrl j).
- You can then edit the XML document in the editor as necessary. It is advisable to check the markup of the conversion program, even after it validates, to make sure it conforms with THL standards.