private void buildMetadataElements(JoeTree tree, String line_ending, StringBuffer buf) {
		Iterator it = tree.getAttributeKeys();
		
		StringBuffer readOnlyAtts = new StringBuffer();
		if (it != null) {
			while (it.hasNext()) {
				String key = (String) it.next();
				Object value = tree.getAttribute(key);
				
				if (isReservedMetadataName(key)) {
					continue;
				}
				
				boolean isReadOnly = tree.isReadOnly(key);
				if (isReadOnly) {
					readOnlyAtts.append(key).append(" ");
				}
				appendMetadataElement(buf, key, value.toString(), line_ending);
			}
		}
		
		if (readOnlyAtts.length() > 0) {
			appendMetadataElement(buf, IS_READ_ONLY_ATTS_LIST, readOnlyAtts.toString().trim(), line_ending);
		}
	}