I have a strings with parmeters, which are the result of my software.
For example, System.out.println("The number is:" + count) is one of the results. The parameters can be any type: int, double or Date type.
Now I want to put this string (with the parameter count, for example) in a vector or any other data structure, and create XML, which would load later. There is any way to do that?
Thanks.
You can create your own java bean that will hold the message, the parameter type, and the value (and probably the parameter name if you need). This custom object can be de/serialized from/to XML by using XStream API it is really simple:
will result in following xml:
to reconstruct the object you just:
Alternatively you can prepare your own (simple in your case) de/serialization utility based on java standard packages (SAX). Example
your xml can be something like:
Good luck!