Revision [850]

This is an old revision of CommandXProperties made by DavidLee on 2009-11-14 09:45:46.

 

Command xproperties



Name

xproperties Manage a Java Properties file


Synopsis

xproperties [options]

-in file - Load a Properties file in text form
-inxml file - Load a Properties file in xml form

-text - Output properties in text form to stdout
-xml - Output properties in xml form to stdout


-d var
-delete var - Delete a variable from the properties

-a var=value
-add var=value - Add a variable (name "var", value "value") to the properties

-comment - Append or update the comment

-v var
-var var - print out the value of a variable (cannot be intermixed with -text or -xml)



Description

xproperties can be used to create new properties files, transform files from text to xml form, add, delete and print property values.

xproperties creates a Java Properties object in memory, then optionaly loads values from a file (in text or xml form), optional adds or updates the properties then prints the resultant properties file in either text or xml form.
The text and XML forms are as specified (and implemented) by the Java java.util.Properties object
if one or more -v (or -var) options are specified then instead of serializeing the entire resultant properties file then one or more values from the (possibly edited) properties file are output followed by a newline.


Examples

Create a new properties file in text form with initial contents
xproperties -text -a var1="Value 1" -add var2="Value 2"


Produces this output
#Sat Nov 14 12:42:24 EST 2009
var2=Value 2
var1=Value 1


Convert the above property file to xml form
xproperties -in file.properties


Produces

<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd" []>
<properties version="1.0">
   <entry key="var2">Value 2</entry>
   <entry key="var1">Value 1</entry>
</properties>


Print out the value of var2 from the above xml format
xproperties -inxml prop.xml -v var2


Produces
Value 2






Return Value

Returns 0 if the command executed successfully, 1 if there was an error.

CategoryCommands
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki