commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mnereson <mikenere...@gmail.com>
Subject read java.util.Properties from XML with digester
Date Mon, 18 Aug 2008 02:12:49 GMT

Anyone know how to read XML content to java.util.Properties?

Input would be something like

<root>
  <properties>
    <propertynameA>value</propertynameA>
    <propertynameB>value</propertynameB>
    <propertynameC>value</propertynameC> 
  <properties>
</root>

I need to have a Properties entity with  three keys (propertynameA,
propertynameB, propertynameC) and three values (value, value value)

I can figure out as much as

final Digester digester = new Digester();
digester.addObjectCreate("root/properties", Properties.class);
... << what goes here to add keys and set values?

final StringReader reader = new StringReader(xml);
Properties properties = (Properties) digester.parse(reader);

But I am not sure how to grab arbitrary elements under "root/properties" and
assign them as a Property key.

Thank you.
-- 
View this message in context: http://www.nabble.com/read-java.util.Properties-from-XML-with-digester-tp19025271p19025271.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