Code example for StringWriter

Methods: toString

		if (null == privacyPolicy) {
			return "<?xml version=\"1.0\" encoding=\""+encoding+"\"?><RequestPolicy></RequestPolicy>";
		Serializer serializer = new Persister(); 
		Writer result = new StringWriter();
		try { 
			serializer.write(privacyPolicy, result);
		} catch (Exception e) {
			Log.e(TAG, "Can't serialize this privacy policy to an XML string.", e);
			return null; 
		return result.toString();
	 * Create a Privacy Policy in a Java format from a XML format Privacy Policy 
	 * @param privacyPolicy Privacy policy 
	 * @return A Java object containing the privacy policy 
	 * @throws PrivacyException