Aug 26 2009

Spring XML and defining end of line characters in a bean property

Published by michael at 8:52 am under Java, Spring, XML

If you need to define and end of line character (EOL) like \n in your Spring XML files in a bean property you can’t do this

<bean id="some-bean-id" class="some-class">
    <property name="my-property-name" value="\n"/>
</bean>

This simply wont work. You’ll end up with a backslash followed by the letter n. What you have to do is to use an escape character like this

<bean id="some-bean-id">
    <property name="my-property-name" value="&#10;"/>
</bean>
Share and Enjoy:
  • Print
  • Sphinn
  • del.icio.us
  • Mixx
  • Google Bookmarks
  • Blogplay
  • Technorati
  • Twitter

No related posts.

No responses yet

Trackback URI | Comments RSS

Leave a Reply