pw.println("\t<firstname>" + current.getFirstName() + "</firstname>"); pw.println("\t<middlename>" + current.getMiddleName() + "</middlename>"); pw.println("\t<lastname>" + current.getLastName() + "</lastname>"); pw.println("\t<street>" + current.getStreet() + "</street>"); pw.println("\t<postcode>" + current.getPostalCode() + "</postcode>"); pw.println("\t<city>" + current.getCity() + "</city>"); pw.println("\t<homenumber>" + current.getHomeTelNumber() + "</homenumber>"); pw.println("\t<mobilenumber>" + current.getMobileTelNumber() + "</mobilenumber>"); pw.println("\t<businessnumber>" + current.getBusinessTelNumber() + "</businessnumber>"); pw.println("\t<othernumber>" + current.getOtherTelNumber() + "</othernumber>"); pw.println("\t<standardnumber>" + current.getStandardTelephoneNumber() + "</standardnumber>"); pw .println("\t<email>" + current.getEmailAddress()
if (current.getFullname().length() > 0) { pw.println("\t<name>"); if (current.getFirstName().length() > 0) pw.println("\t\t<firstname>" + current.getFirstName() + "</firstname>"); if (current.getMiddleName().length() > 0) pw.println("\t\t<middlename>" + current.getMiddleName() + "</middlename>"); if (current.getLastName().length() > 0) pw.println("\t\t<lastname>" + current.getLastName() + "</lastname>"); pw.println("\t</name>"); }  if ((current.getStreet().length() > 0) || (current.getPostalCode().length() > 0) || (current.getCity().length() > 0)) { pw.println("\t<address>"); if (current.getStreet().length() > 0) pw.println("\t\t<street>" + current.getStreet() + "</street>"); if (current.getPostalCode().length() > 0) pw.println("\t\t<postcode>" + current.getPostalCode() + "</postcode>"); if (current.getCity().length() > 0) pw .println("\t\t<city>" + current.getCity() + "</city>"); pw.println("\t</address>"); } String std; if (current.getStandardTelephoneNumber().getNumber().equals( current.getMobileTelNumber().getNumber())) std = "mobile"; else if (current.getStandardTelephoneNumber().getNumber() .equals(current.getBusinessTelNumber().getNumber())) std = "business"; else if (current.getStandardTelephoneNumber().getNumber() .equals(current.getOtherTelNumber().getNumber())) std = "other"; else std = "home";  pw.println("\t<phonenumbers standard=\"" + std + "\">"); if (current.getHomeTelNumber().getNumber().length() > 0) pw.println("\t\t<number type=\"home\">" + current.getHomeTelNumber() + "</number>"); if (current.getMobileTelNumber().getNumber().length() > 0) pw.println("\t\t<number type=\"mobile\">" + current.getMobileTelNumber() + "</number>"); if (current.getBusinessTelNumber().getNumber().length() > 0) pw.println("\t\t<number type=\"business\">" + current.getBusinessTelNumber() + "</number>"); if (current.getOtherTelNumber().getNumber().length() > 0) pw.println("\t\t<number type=\"other\">" + current.getOtherTelNumber() + "</number>");  pw.println("\t</phonenumbers>");  if (current.getEmailAddress().length() > 0) { pw.println("\t<internet>"); if (current.getEmailAddress().length() > 0) pw.println("\t\t<email>" + current.getEmailAddress()
	public void saveToXMLFile(String filename) {		Debug.msg("Saving to file " + filename);		FileOutputStream fos;		try {			fos = new FileOutputStream(filename);			PrintWriter pw = new PrintWriter(fos);			pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");			pw.println("<!DOCTYPE phonebook SYSTEM \"" + PHONEBOOK_DTD_URI					+ "\">");			pw.println("<phonebook>");			pw.println("<comment>Phonebook for " + JFritz.PROGRAM_NAME + " v"					+ JFritz.PROGRAM_VERSION + "</comment>");			Enumeration en = persons.elements();			while (en.hasMoreElements()) {				Person current = (Person) en.nextElement();				pw.println("<entry>");				pw.println("\t<firstname>" + current.getFirstName()						+ "</firstname>");				pw.println("\t<middlename>" + current.getMiddleName()						+ "</middlename>");				pw.println("\t<lastname>" + current.getLastName()						+ "</lastname>");				pw.println("\t<street>" + current.getStreet() + "</street>");				pw.println("\t<postcode>" + current.getPostalCode()						+ "</postcode>");				pw.println("\t<city>" + current.getCity() + "</city>");				pw.println("\t<homenumber>" + current.getHomeTelNumber()						+ "</homenumber>");				pw.println("\t<mobilenumber>" + current.getMobileTelNumber()						+ "</mobilenumber>");				pw.println("\t<businessnumber>"						+ current.getBusinessTelNumber() + "</businessnumber>");				pw.println("\t<othernumber>" + current.getOtherTelNumber()						+ "</othernumber>");				pw.println("\t<standardnumber>"						+ current.getStandardTelephoneNumber()						+ "</standardnumber>");				pw						.println("\t<email>" + current.getEmailAddress()								+ "</email>");				pw.println("\t<category>" + current.getCategory()						+ "</category>");				pw.println("</entry>");			}			pw.println("</phonebook>");			pw.close();		} catch (FileNotFoundException e) {			Debug.err("Could not write " + filename + "!");		}	}