@Override public void serializeContent(XmlSerializer serializer) throws IOException { if (isEmpty()) return; SerializerUtils.addTextTag(serializer, VCardProperty.FN.toString(), getFormattedName()); serializer.startTag(null, N_NAME); for (Entry<NameProperty, String> entry : name.entrySet()) SerializerUtils.addTextTag(serializer, entry.getKey().toString(), entry.getValue()); serializer.endTag(null, N_NAME); for (Entry<VCardProperty, String> entry : properties.entrySet()) if (entry.getKey() != VCardProperty.FN) SerializerUtils.addTextTag(serializer, entry.getKey().toString(), entry.getValue()); for (Photo photo : photos) photo.serialize(serializer); for (Address address : addresses) address.serialize(serializer); for (Label label : labels) label.serialize(serializer); for (Telephone telephone : telephones) telephone.serialize(serializer); for (Email email : emails) email.serialize(serializer); for (Logo logo : logos) logo.serialize(serializer); for (Sound sound : sounds) sound.serialize(serializer); for (Geo geo : geos) geo.serialize(serializer); for (Organization organization : organizations) organization.serialize(serializer); if (!categories.isEmpty()) { serializer.startTag(null, CATEGORIES_NAME); for (String keyword : categories) SerializerUtils.addTextTag(serializer, KEYWORD_NAME, keyword); serializer.endTag(null, CATEGORIES_NAME); } if (classification != null) SerializerUtils.addTextTag(serializer, CLASS_NAME, classification.toString()); for (Key key : keys) key.serialize(serializer); }
public static Person getObject() { Person person = new Person(); person.setNamespaces(new Namespace("tns", "http://www.pinae.com")); person.setNamespaces(new Namespace("tns2", "http://www.pinae.org")); person.setId(1); Person.Sex sex = person.new Sex(); sex.setValue("1"); Website website1 = new Website(); website1.setValue("http://www.google.com"); Website website2 = new Website(); website2.setValue("http://www.baidu.com"); Website website3 = new Website(); website3.setValue("http://www.163.com"); Website website4 = new Website(); website4.setValue("http://www.21cn.com"); person.setWebsite(website1); person.setWebsite(website2); person.setWebsite(website3); person.setWebsite(website4); Name name = new Name(); Name.Firstname firstname = name.new Firstname(); Name.Lastname lastname = name.new Lastname(); firstname.setValue("Tom"); lastname.setValue("Jim"); name.setFirstname(firstname); name.setLastname(lastname); Telephone telephone = new Telephone(); Telephone.Mobile mobile = telephone.new Mobile(); mobile.setNet("gsm"); mobile.setValue("13343351822"); Telephone.Office office = telephone.new Office(); office.setValue("010-8556697"); Telephone.Home home = telephone.new Home(); home.setValue("0757-82988679"); telephone.setHome(home); telephone.setOffice(office); telephone.setMobile(mobile); person.setBirthday(new Date()); person.setName(name); person.setAge(23); person.setSex(sex); person.setTelephone(telephone); person.setOther(new CdataText("<XML>Tearcher</XML>")); person.setPc("<Model>Acer 4750G</Model>"); return person; }
/** @param telephone */ private void addDeletedTelephone(Telephone telephone) { if (telephone.isSaved()) { this.deletedTelephones.add(telephone); } }