automatic xml conversion in scala

Posted by Jeff Bowman on Stack Overflow See other posts from Stack Overflow or by Jeff Bowman
Published on 2010-06-08T03:44:41Z Indexed on 2010/06/08 3:52 UTC
Read the original article Hit count: 246

Filed under:

Let's say I have the following class:

class Person(val firstName:String, val lastName:String)

Is there an automatic way to generate xml from this class without having to hand create a toXml() method? Ideally the output would be something like:

    <Person>
        <firstName>John</firstName>
        <lastName>Smith</lastName>
    </Person>

It seems like there should be a way to do this without having to write all that out manually. Perhaps there is a trait I haven't found yet?

© Stack Overflow or respective owner

Related posts about scala