Automatically convert xml to scala

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 create a toXml () method? Ideally, the output would be something like this:

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

There seems to be a way to do this without writing it all down manually. Perhaps there is a trait that I have not yet found?

+5
source share
2 answers

case ( Product) : productPrefix, productIterator, productElementName.

, productElementName : 20958 21223, -, , ( ).

+5

, , . - XStream. , , Scala , , , . - , , .

+3

All Articles