On Oct 8, 2009, at 4:08 AM, Gaurav Upadhyay wrote:


I have a xml string and need to use commons configuration with it.

How can i create a configuration on it?

Example:

String test = "<?xml version=\"1.0\"
encoding=\"utf-8\"?><username><firstname>Tom</firstname>
<lastname>Jay</lastname></username>"

and i just need to create a configuration and access :

config.getString("firstname");
--

I would suggest you give this a try.

ByteArrayInputStream is = new ByteArrayInputStream(test.getBytes());
XMLConfiguration config = new XMLConfiguration();
config.setFileName("test"); // May not be necessary
config.load(is);


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to