Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

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