Pergunta

Possible Duplicate:
What is the best way to convert a java object to xml with open source apis

I found existing questions 1 and 2 on the subject, but I wasn't sure if it was up-to-date, and the best fit for what I'm trying to do.

I've had one strong suggestion of XMLBeans, but there isn't too much discussion on it here on SO, and it's not even mentioned on the first link above (not with any upvotes, anyway).

Is JAXB still the best recommendation for this? If so, are there any simple tutorials that walkthrough A->B with object->xml?

Update: I'm being given Lists of java objects, and need to convert them to xml following a given schema.

Foi útil?

Solução

I'd go with XStream, as your question 2 suggests.

It needs no annotations, just configuration, and can serialize simple objects out of the box. To make the objects fit a given schema, you'd convert them to objects that closely resemble the schema first and serialize those to XML.

The XStream page also holds the tutorials you request.

Outras dicas

I prefer to use JAXB that supports both annotation and XML based mapping.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top