With this project you can import your articles from an xml file to your wordpress installation, without scripting else than a configure file.
NB: this article it outdated!
License: GPL 2
To compile from your own this code you must have jargs, jaxen and DOM4j. The jar doesn’t need them.
This program is useful to import xml files as wordpress articles in SQL insert
statement. You can use it and then import all this articles in your existing
wordpress mysql database.
If you have an input.xml file with all your articles to import, you must provide
some information where to find the article text, date, object title and author.
Those information are on structure.xml file. In a large number of situation you will need
to change only this file to get all your articles on SQL.
The author is taken from an “email” xml element, and it must be the same of a user
of the wordpress database installation.
If you don’t have an email field, remember that you can edit the xml input file
to change a field wich is unique for a author and replace all occurrences of it with his
email, to get all things work in the sql. If you have only an author, you can delete
the email in the structure.xml file and set the default author.
The same is for category: If you have a categoryID it must be the same of wordpress database
category table. If not, control and replace all occurrences, or use the defaultCategoryID.
Permalink has the structure: baseUrl +
Then you can run the application, with this command line (I use Linux, you can convert
it with windows urls)
java -jar XMLtoWordpress-0.1.jar -i /home/me/turroni3.xml -o /home/me/turroni.sql -s /home/me/structure.xml
Maybe you have to convert the charset of the output file, depending on the charset used by your MySQL database.
Mine was latin1 in the database (you can see this value in a phpMyAdmin interface
of the table structure), but utf-8 in wordpress (you can read this value
in wordpress admin-options interface).
I had to do:
iconv –from-code latin1 –to-code utf-8 outputFile.sql > correctCharsetFile.sql