I was generating a compressed archive installable for the template, i.e. mytemplate.zip. I did this on Mac OS X 10.5.x Finder, by selecting all the files and directories of the template, right-clicking on one of the file icons, and selecting "Compress". Finder produced a file "Archive.zip", which I renamed.
Mac OS X archive utilities like compress and tar store metadata and resource forks for files in sidecar files with a "._" prefix followed by the main file's name. They put these in a subdirectory tree __MACOSX. Thus my archives had an 82-byte file __MACOSX/._templateDetails.xml
in addition to the correct templateDetails.xml
. See OSX Considered harmful
for someone else who found this behaviour an obstacle.
The template installer looks for all files with an extension ".xml" in the archive, and calls JSimpleXML::_parse() on each one of them. It looks like there was something about the ._templateDetails.xml
file which caused the parser to throw an error, not just return a failure code. This provoked JSimpleXML to produce the XML Parsing Error at 1:1. Error 4: Empty document
message, before using the correct templateDetails.xml
file to complete the installation.
It's interesting that Joomla 1.5.9 reports an error message, while Joomla 1.5.3 does not. I'm guessing that 1.5.9 is more diligent about passing error messages on to the user. I think it would be helpful if Joomla would extend this error message to include a file name. Maybe even not pass on such error messages as long as one of the XML files in the archive is valid.
The fix for this problem is one of:
- Use some platform other than Mac OS X to generate your installable archives.
- On Mac OS X, compress from the shell. Execute export COPYFILE_DISABLE=true first, then your compress command like zip -r ../mytemplate.zip *.
I hope this saves someone the several hours I spent diagnosing this error message. Enjoy!
Jim DeLaHunt, multilingual website consultant (jdlh.com
), Vancouver, Canada. http://blog.jdlh.com