commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gaurav Upadhyay <gaurav.upadhyaya.i...@gmail.com>
Subject Re: [CONFIGURATION] Create configuration out of XML String
Date Tue, 13 Oct 2009 07:43:21 GMT

Thanks, That worked...!

yippiee..!


Ralph Goers wrote:
> 
> 
> 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-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-CONFIGURATION--Create-configuration-out-of-XML-String-tp25802002p25868478.html
Sent from the Commons - User mailing list archive at Nabble.com.


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


Mime
View raw message