Juffrou-XML-Spring Reference Documentation This document refers to version of the Juffrou-XML-Spring.

Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.

Carlos Martins Getting Started with Juffrou-XML-Spring


Juffrou-XML-Spring is the implementation of springframework's (spring-oxm) Marshaller and Unmarshaller interfaces using Juffrou-XML.


Maven projects

To start using Juffrou-XML in your maven project just add the following dependency:

This will allow you access the source code of the library as well as the javadoc files, if you have checked the options "download artifact sources" and "download atifact javadoc in your IDE."

Non maven projects

Download the file juffrou--bundle.zip from the website and extract it's contents to a temporary directory.

Add juffrou-reflect-.jar, juffrou-xml-.jar and juffrou-xml-spring-.jar to the classpath of your project and you are good to go.

Configuring Juffrou-XML though Spring

In a spring application context, Juffrou-XML is a bean and can be configured like any other bean in spring.

Juffrou-XML Spring Configuration

    <bean id="marshaller" class="net.sf.juffrou.xml.JuffrouXmlSpring">
    	<property name="mappingLocations">

In the above example spring tells juffrou-xml to load its configuration from several mapping files.

Defining serializers as spring beans

Serializers may be used to convert between the text in an XML element and a complex type. With juffrou-xml-spring you can define your serializers as java beans and thus take advantage of spring's dependency injection mechanism.

For example purposes lets consider the SimpleDateSerializer from the spring-xml reference. First we would define the serializer bean:

	<bean id="mySimpleDateSerializerBean" class="net.sf.juffrou.xml.test.dom.SimpleDateSerializer">

    <bean id="marshaller" class="net.sf.juffrou.xml.JuffrouMarshaller">
    	<property name="mappingLocations">

To use this serializer bean in juffrou-xml you would configure the configuration mapping like the following example:

<?xml version="1.0" encoding="UTF-8"?>
<mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

	<root-element xml="Person" type="net.sf.juffrou.xml.test.dom.Person">
		<attribute property="firstName" xml="name" />
		<element property="lastName" xml="Surname" />
		<element property="birthDay" xml="birthday">
			<serializer bean="mySimpleDateSerializerBean"/>