[XML Résumé Library] Quick Setup Guide

Update: The commenter, Uri, was kind enough to inform me that the use of FOP 1.0 will prevent XML Resume from generating legible PDFS. The solution is to downgrade FOP to version 0.20.X. If you are using freebsd, for example, you can downgrade with portdowngrade fop and selecting version “13 2006/03/15 12:55:57 0.20.5

The XML Resume Library will be my tool of choice from now on for updating and producing resumes in various formats. It will make my life much easier than what used to be done in the past, which was to maintain three separate resumes. There was the fully-abridged resume that captured everything ever done relating to work. And the two other were narrowed down, more specific resumes depending on the job I was after. With the XML Resume Library I should now be able to maintain just one file! Using a simple Makefile is essentially all that’s needed.

This write up just covers the steps I took to install the XML library and does not go into how to properly write an ‘xml resume’. For that you can visit the XMLRésuméLibrary site and read the necessary docs there.

In short, from the website:

The XML Résumé Library is an XML and XSL based system for marking up, adding metadata to, and formatting résumés and curricula vitae.

First, before we can fully use the textproc/resume package, we need to make sure the following prerequisite packages are installed. Below are the steps performed on my FreeBSD system and may be different depending on the type of system you are using:

  • java/diablo-jdk (or jre)16: Permits the execution of Java applications.
  • textproc/xerces-j: XML parser for Java.
  • textproc/xalan-j: Xalan-Java is an XSLT processor for transforming XML documents into HTML, text, or other XML document types.
  • textproc/fop: The world’s first print formatter driven by XSL formatting objects.

Note: I assume java is installed on the system.

Let’s check if the rest are installed:

# pkg_info | egrep "(xerces-j|xalan-j|fop)"

Depending on the response from “pkg_info” use your favorite package-management tool to install the necessary packages. In my case all three need to be installed:

# portmaster textproc/fop textproc/xalan-j textproc/xerces-j
...edited...
===>>> The following actions will be taken if you choose to proceed:
        Install textproc/fop
        Upgrade apache-ant-1.7.1 to apache-ant-1.8.2
        Install textproc/xalan-j
        Install textproc/xerces-j

===>>> Proceed? y/n [y]
...edited...
===>>> The following actions were performed:
        Upgrade of apache-ant-1.7.1 to apache-ant-1.8.2
        Installation of textproc/fop (fop-1.0)
        Installation of textproc/xerces-j (xerces-j-2.11.0)
        Installation of textproc/xalan-j (xalan-j-2.7.1)

58.768u 19.313s 2:32.69 51.1%   119+961k 8658+863io 1587pf+0w

After the rest of the packages are installed populate the java ‘ext/’ folder to contain the jar files installed by each of: Xerces-j, Xalan-j and FOP. The full path to the java ‘ext/’ folder on my system is: /usr/local/diablo-jdk1.6.0/jre/lib/ext/, but yours may vary. The initially contents of ‘ext/’ is:

# ls /usr/local/diablo-jdk1.6.0/jre/lib/ext/
dnsns.jar               meta-index              sunpkcs11.jar
localedata.jar          sunjce_provider.jar

Use this one-liner below to copy all necessary jar files from the three packages above into the ‘ext/’ folder:

for p in `echo xerces-j xalan-j fop`; do pkg_info -xL $p | grep jar | xargs -I {} cp {} /usr/local/diablo-jdk1.6.0/jre/lib/ext/; done

The ‘ext/’ folder should now contains the following jars:

# ls /usr/local/diablo-jdk1.6.0/jre/lib/ext/
  avalon-framework-4.2.0.jar  localedata.jar              xercesImpl-2.7.1.jar
  batik-all-1.7.jar           meta-index                  xercesImpl.jar
  commons-io-1.3.1.jar        serializer-2.7.0.jar        xml-apis-1.3.04.jar
  commons-logging-1.0.4.jar   serializer.jar              xml-apis-ext-1.3.04.jar
  dnsns.jar                   servlet-2.2.jar             xml-apis.jar
  fop-hyph.jar                sunjce_provider.jar
  xmlgraphics-commons-1.4.jar
  fop-sandbox.jar             sunpkcs11.jar               xsltcapplet.jar
  fop-transcoder-allinone.jar xalan-2.7.0.jar             xsltcbrazil.jar
  fop-transcoder.jar          xalan.jar                   xsltcejb.jar
  fop.jar                     xalansamples.jar            xsltcservlet.jar

Now we should be able to test the resume examples. First, copy locally /usr/local/share/examples/resume to “xmlresume”:

`--> cp -r /usr/local/share/examples/resume xmlresume
`--> ls xmlresume
Makefile     addressing   build.xml    example1.xml example2.xml

“Makefile” is used to generate the various formats from the example1.xml file. To make sure everything is working you can try to run a test generation using the “example1.xml” file which should product the extensions: .txt, .html, .pdf:

`--> gmake resume=example1
java org.apache.xalan.xslt.Process  -in example1.xml -xsl http://xmlresume.sourceforge.net/xsl/output/us-html.xsl -out example1.html
java org.apache.xalan.xslt.Process  -in example1.xml -xsl http://xmlresume.sourceforge.net/xsl/output/us-text.xsl -out example1.txt
java org.apache.xalan.xslt.Process  -in example1.xml -xsl http://xmlresume.sourceforge.net/xsl/output/us-letter.xsl -out example1.fo
java org.apache.fop.apps.Fop -fo  example1.fo -pdf example1.pdf
Exception in thread "main" java.lang.NoSuchMethodError: main
gmake: *** [example1.pdf] Error 1

Oops! Looks like we had issues trying to build the .pdf file. If you received the above “Exception in thread “main” java.lang.NoSuchMethodError: main” with regards to the .pdf file generation then try editing your “Makefile” and change the line

pdf_proc = java org.apache.fop.apps.Fop -fo $(fo_flags) $(in) -pdf $(out)

to

pdf_proc = java org.apache.fop.cli.Main -fo $(fo_flags) $(in) -pdf $(out)

I am no java expert and a search on google lead me to this solution. Trying again leads to:

`--> gmake resume=example1
java org.apache.fop.cli.Main -fo  example1.fo -pdf example1.pdf

Note: However, it should be noted that the above is a very bad-hack! It will cause ugly looking pdfs! I have no proper workaround at the moment, but will post should I find one. Or, if you know how to make the original “java org.apache.fop.apps.Fop” work, please let me know!

`--> ls
Makefile      addressing    build.xml     example1.fo   example1.html example1.pdf  example1.txt  example1.xml  example2.xml

I suggest reading the User Guide on how to really take advantage of this neat tool!

Advertisements
This entry was posted in *Nix. Bookmark the permalink.

2 Responses to [XML Résumé Library] Quick Setup Guide

  1. Uri Simchoni says:

    I realize it might be a bit late for commenting on that, but using FOP 0.20.5 with latest xalan worked for me “out of the box” and produced a nice PDF, whereas fop-1.0 didn’t work, and, after tweaking, produced a “cropped” PDF.

    • swinful says:

      Hi Uri,

      Thank you very much for deciding to follow up with your comment. Just tried your suggestion and I can now generate PDFs; it is never too late. -;)

      Cheers!
      -swinful

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s