Skip to content
IgorOrsag edited this page Jun 19, 2014 · 10 revisions

CVgenerator

Simple web app that generates you CV based on your profile.

Contributors

  1. Dominik Hanák
  2. Adam Ryvola
  3. Igor Orság
  4. Július Stašík

Application model

Descritpion of application design and components.

##Data retrieving Application retrieves user's CV data from .jsp form. Form posts all data by http request on ProfilerServlet, which handles further data processing. ##form.jsp JSP contains form for user's informations, button for generate cv and input with button for load CV. On the top of page is simple logo. JSP also has css, just for buttons design and text align. Form is designed by jQuerry css and script (ThemeRoller). It is just table and list of tabs. Button design is in own css. Input types are text, number, email and url. These types are possile from HTML5. Date is text type defined by regular expression. Regex allow us the check before send data to servlet. Phone number is also defined by regex. Language level is selection between three choices. Thesis is textarea. Some inputs have attribut placeholder. This attribute can show possible value or description (phone number, address fields). Attribute value is for set variable param for sending data to servlet. Prefix "c" is for JSTL (JSP standard tag library) and JSP can communicate with servlet via this library. For load stored information user have to know ID. User types ID in input and informations are loaded into web form for edit.

##load.jsp Servlet sends xml string with content of user profile. For xml parsing on JSTL site we must include XALAN dependecy to Maven. Load.jsp site contains JSTL <x:parse> tag for parsing string with user profile xml into xml document node variable called output. Jstl tag <x:out select="Xpath"> uses XPath expression for selection of descendant node from output document node. JSTL tag <c:set var"variableName"> assigns value found by XPath into variable, which is printed in appropiate input tag in form.

Data storing

CV data of all users are stored in profiles.xml file. Each user is mapped into separate profile element with unique pid attribute represented by random string. Xml schema of profiles.xml is defined in profiles.xsd file.

##Data processing StartListener initializes xml Document from profiles.xml file , where all profiles are stored.

ProfilerServlet receives http request with CV data. ProfilerServlet makes instance of Profiler class. Profiler class provides functionality for creating elements of profiles.xml according to xml schema, 'profiles.xsd', and returns complete profile element. ProfilerServlet adds profile element into profiles document.

An unique profile id is returned by ProfilerServlet to user as key to his cv document. ProfilerServlet provides xml transformation of user profile element into LaTex format.

##Servlet

Servlet takes data from JSP and creates profile in profiles.xml using Profiler. Profiler uses some of it's methods to create profile element according to schema: profiles.xsd. Servlet then saves profile into xml document, validates it and transforms desired profile into latex document. After calling pdflatex on this latex document the pdf file is offered as download in users browser. User is able to load his profile, if he comes later. He just needs to remember his ID and give it to jsp.

##Servlet - Load Servlet contains method createProfileDocument() for selection of user profile from profiles.xml file by unique pid attribute. Method createProfileDocument(Document doc, String loadPid) selects profile element identified by loadPid argument from Document doc argument. Selected profile element is then imported into newly created Document node which is returned. Method documentToString(Document doc) transforms Document node into string with document xml. Servlet sets and sends request with xml string attribute that contains complete user profile. Profile string is processed by XALAN on site.

##Servlet - Validation For validation servlet uses class ProfileValidator with functions parse and validate. Class constructor argument is schema file. According schema, xml file is validated and parsed. For parsing is used instance of DocumentBuilder.
Function validate returns error message if file is not valid, null when file is valid. Function parse returns document node.

##In other words:

ProfilerServlet creates a XML element using JAXP. This XML element contains data needed to create CV for user and it is stored in XML file with other profiles under unique id.

Data are then transformed into LaTEX format, using XSLT transformation, and created CV is given to user under random url.

##XML Schema

Xml schema structure is similar to form where user infromation is typed. Each profile contains mandatory elements: contact with full name, address and another contacts. Phone, fax, email, homepage are patterned with regular expression. Homepage and fax are not mandatory.

details, that contains mandatory string typed elements gender, birthplace, citizenship and mandatory regular expession pattrened element birthdate.

education, experience have declared common schoolType. SchoolType element contains one name attribute with school or job institution name. Two elements from, to stores info about start and end date.

language contains two mandatory string attributes storing name of language and level of knowledge.

Elements thesis and reference are not required. Reference element contains contact information of person who refers on CV writer and their mutual relationship. Reference element contains not required relationship element and mandatory contact element described before.

##XSL transformation.

XSL transformation transforms XML file into .tex, which is according to this template http://ctan.org/pkg/cv. Parameter $pid is representing one and only profile from profiles.xml, we are searching according to this parameter. omit-xml-declaration="yes" we need to omit XML header because latex does not recognize those tags. xsl:text disable-output-escaping="yes" we need to disable output escaping because latex does not recognize escaping.

Clone this wiki locally