i need to write data in the form of Java Objects into XML documents. Is XML Pull parser a good choice for this task?
Can someone share a sample implementation for this?
Well, no. Any XML parser -- pull or otherwise -- is for the purpose of converting XML documents into some internal form (such as Java objects). Your requirement is the other way around.
Well, in that case, can you suggest some utility. I was under the impression that you can do xml-to-java as well as the other way round using these parsers.
Were you asking about StAX? It's one of the class of pull parsers, but it can also act as a serializer. Whether all instances of that class can serialize as well, I don't know. Probably not.
If that's the case then the trivial answer is yes. However you would have to write all the code which extracted the data from those objects and called the appropriate serializer methods. There isn't any Java-to-XML binding built into StAX that I'm aware of.
From the looks of it, seems like StAX (and hence XPP) isin't what I should use. Well, I don't HAVE to use XPP, so I am open to any other API. Can you suggest some?