Thread: D20
View Single Post
heratyk
Junior Member
 
Join Date: Aug 2008
Posts: 14

Old January 23rd, 2009, 07:49 PM
There are several ways to convert from html to text. You could open the file in Microsoft Word or a similar word processor and select save as...text. You could highlight the text in your web browser, copy, and paste into notepad. Or you could open the html file in your favorite text editor and do a search & replace for anything between < and >.

The .dat files for Hero Lab are in XML format (HTML is a subset of XML), so converting to text might be a step backwards. If you have different parts of the description formatted differently (for instance, name is a heading, price is in italics, description is in 12-point arial), you can do a search & replace in a text editor to save some work. So, in this example, if your html document has the item name as formatted as heading2, it might look like:
<h2>Boots of Stinking</h2>
You can replace all instances of <h2> with name=" and all instances of </h2> with "
That would make it look like:
name="Boots of Stinking"

Then you can do the same thing with other elements of the listing, fill in the missing XML tags, and just save the text-only file with a .dat extension.

Here is an example of a magic weapon from srd_magicweapons.dat in Hero Lab:

<thing
id="iAdmDagger"
name="Adamantine Dagger"
compset="MagicWep"
description="This nonmagical dagger is made out of adamantine. As a masterwork weapon, it has a +1 enhancement bonus on attack rolls.{br}{br}No aura (nonmagical); Price 3,002 gp.">
<fieldval field="gCost" value="3000"/>
<fieldval field="gSizeCost" value="2"/>
<fieldval field="wAttBonus" value="1"/>

<child entity="wSpecMagic">
<bootstrap thing="wDagger"/>
</child>
</thing>
heratyk is offline   #2 Reply With Quote