public class

XMLPropertySet

extends SerializablePropertySet
java.lang.Object
   ↳ com.opensymphony.module.propertyset.AbstractPropertySet
     ↳ com.opensymphony.module.propertyset.memory.MemoryPropertySet
       ↳ com.opensymphony.module.propertyset.memory.SerializablePropertySet
         ↳ com.opensymphony.module.propertyset.xml.XMLPropertySet

Class Overview

The XMLPropertySet behaves as an in-memory typed PropertySet, with the ability to load and save all the properties to/from an XML document.

  • boolean, int, long, double and String properties are saved as simple Text nodes.
  • text and XML properties are stored as CDATA blocks.
  • java.util.Date properties are stored in yyyy-mm-dd HH:mm:ss format.
  • java.util.Properties properties are stored in child elements.
  • java.lang.Object and byte[] data properties are encoded using base64 into text and stored as CDATA blocks.

Example:

XMLPropertySet p = new XMLPropertySet(); // create blank property-set
p.load( new FileReader("my-properties.xml") ); // load properties from XML.
System.out.println( p.getString("name") );
p.setString("name","blah blah");
p.save( new FileWriter("my-properties.xml") ); // save properties back to XML.

Summary

[Expand]
Inherited Constants
From interface com.opensymphony.module.propertyset.PropertySet
[Expand]
Inherited Fields
From class com.opensymphony.module.propertyset.AbstractPropertySet
Public Constructors
XMLPropertySet()
Public Methods
void load(InputStream in)
Load properties from XML input.
void load(Reader in)
Load properties from XML input.
void loadFromDocument(Document doc)
Load properties from XML document.
void save(Writer out)
Save properties to XML output.
void save(OutputStream out)
Save properties to XML output.
Document saveToDocument()
Save properties to XML Document.
[Expand]
Inherited Methods
From class com.opensymphony.module.propertyset.memory.SerializablePropertySet
From class com.opensymphony.module.propertyset.memory.MemoryPropertySet
From class com.opensymphony.module.propertyset.AbstractPropertySet
From class java.lang.Object
From interface com.opensymphony.module.propertyset.PropertySet

Public Constructors

public XMLPropertySet ()

Public Methods

public void load (InputStream in)

Load properties from XML input.

Throws
IOException
ParserConfigurationException
SAXException

public void load (Reader in)

Load properties from XML input.

Throws
IOException
ParserConfigurationException
SAXException

public void loadFromDocument (Document doc)

Load properties from XML document.

public void save (Writer out)

Save properties to XML output.

Throws
IOException
ParserConfigurationException

public void save (OutputStream out)

Save properties to XML output.

Throws
IOException
ParserConfigurationException

public Document saveToDocument ()

Save properties to XML Document.

Throws
ParserConfigurationException