PDA

View Full Version : Frustration with parser



jimlunde
August 3rd, 2011, 23:56
I have spent significant time on the forums and have been able to parse the monsters from MM, MM2, MM3, MV, MVTttNV, OG, etc. None worked without errors, and I had to modify the scraped files to get them to parse correctly, but none-the-less, they are done.

Now I am working on powers and feats. I have scraped all the sources I want, but continually get errors during the parsing process due to xml non-conformity. I can find the error in the .xml file and fix them, but when I reparse, it re-creates a new .xml file and include the errors again. I cannot fix the original text files because the .xml tags don't exist in them.

A workaround was to step through (over and over again for every error) the scraped .txt files and remove every power that errored (the majority of which were powers with secondary attacks), put them in a seperate file, and do it until it parsed correctly. This is very time consuming since there could be 10-20 errors for every file, or more.

My question is; Is there a way to turn a .xml file into a mod file?

If I reparse, it starts with the scraped .txt file, turns it into a .xml file, then turns that into the .mod file. I simply want to convert the "corrected" .xml file into a mod file without starting with the scraped .txt files.

I hope this isn't too confusing. Thanks in advance for any input.

Zeus
August 4th, 2011, 09:18
A module file (.mod) is just a renamed .zip archive.

To create a module manually you will need two files:

definition.xml

This file is kinda of like the header file. It defines the name of the module and which ruleset it can be used with. See the block below for an example of the block of XML included in the definition.xml file.



<?xml version="1.0" encoding="iso-8859-1"?>
<root version="2.8">
<name>My Module</name>
<author>DrZeuss</author>
<ruleset>4E</ruleset>
</root>


client.xml or common.xml or db.xml

These files are the data files for the module. Client.xml should be used if the module is intended for clients as well as the host. The module file needs to be stored locally on EVERY players FGII install (under the app data /modules folder). Common.xml is again for clients and hosts, however the module is stored only on the hosts FGII install (under app data folder/modules) and transferred to clients on request. Finally db.xml is a host only module.

Once you have your two module files, ZIP them up using WinZIP and rename the resulting .zip file as a .mod file. Now copy the .mod to the FGII app data folder under the subfolder modules.

You should now be able to see the modules under FGII (you may need to restart your campaign if it was already started when you copied the module).

EugeneZ
August 5th, 2011, 03:15
Now I am working on powers and feats. I have scraped all the sources I want, but continually get errors during the parsing process due to xml non-conformity. I can find the error in the .xml file and fix them, but when I reparse, it re-creates a new .xml file and include the errors again. I cannot fix the original text files because the .xml tags don't exist in them.

DrZeuss's detailed answer probably answered your question, but, coincidentally, I think the source of your real issues is NOT the XML, but actually the data file. I know it doesn't seem that way... obviously there is invalid XML. The reason that invalid XML is created is because the parser has specific expectations about the text files. I am reasonably certain it would be less time consuming for you in the long run to just figure out what unexpected thing you are doing in the file and just not do it anymore rather than fix the XML file by hand and repackage the mod.

I recommend that next time you encounter an error, identify the section of the text file the invalid XML was generated from and post it here. We can find the source of the problem (and since I am now maintaining the parser code, possibly even make the parser respect your usage properly).