Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

example of storeToXML method in java

  • 11-03-2005 10:54PM
    #1
    Closed Accounts Posts: 839 ✭✭✭


    Can someone please give me an example of using the storeToXML method in java, it's in the java.util.properties package heres the prinout from sun.java.com, but I can't figure out how to use it, i want to be able to save several options and then a values for the options in the xml.

    storeToXML

    public void storeToXML(OutputStream os,
    String comment,
    String encoding)
    throws IOException

    Emits an XML document representing all of the properties contained in this table, using the specified encoding.

    The XML document will have the following DOCTYPE declaration:

    <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"&gt;


    If the specified comment is null then no comment will be stored in the document.

    The specified stream remains open after this method returns.

    Parameters:
    os - the output stream on which to emit the XML document.
    comment - a description of the property list, or null if no comment is desired.
    Throws:
    IOException - if writing to the specified output stream results in an IOException.
    NullPointerException - if os is null, or if encoding is null.
    Since:
    1.5
    See Also:
    loadFromXML(InputStream)


Comments

  • Closed Accounts Posts: 248 ✭✭comanche


    persume its

    java.io.OutputStream os = new java.io.FileOutputStream("props.xml");
    properties.storeToXML(os,
    "last updated " + new java.util.Date(), "UTF8");
    os.close();


Advertisement