public XMLElement toXML() { XMLElement xmlResult = new XMLElement("info"); addStringChild(xmlResult, "title"); if (!getSellerName().equals("(unknown)") && mSeller != null) { XMLElement xseller = mSeller.toXML(); xmlResult.addChild(xseller); } Date start = getStart(); if (start != null) { XMLElement xstart = new XMLElement("start"); xstart.setContents(Long.toString(start.getTime())); xmlResult.addChild(xstart); } Date end = getEnd(); if (end != null) { XMLElement xend = new XMLElement("end"); xend.setContents(Long.toString(end.getTime())); xmlResult.addChild(xend); } XMLElement xbidcount = new XMLElement("bidcount"); xbidcount.setContents(Integer.toString(getNumBids())); xmlResult.addChild(xbidcount); XMLElement xinsurance = addCurrencyChild(xmlResult, "insurance"); if (xinsurance != null) xinsurance.setProperty("optional", isInsuranceOptional() ? "true" : "false"); if (getCurBid() != null && !getCurBid().isNull()) { if (getCurBid().getCurrencyType() != Currency.US_DOLLAR) { addCurrencyChild(xmlResult, "usprice", Currency.US_DOLLAR); } } addCurrencyChild(xmlResult, "currently"); addCurrencyChild(xmlResult, "shipping"); addCurrencyChild(xmlResult, "buynow"); addCurrencyChild(xmlResult, "buy_now_us"); addCurrencyChild(xmlResult, "minimum"); XMLElement xdutch = addBooleanChild(xmlResult, "dutch"); if (xdutch != null) xdutch.setProperty("quantity", Integer.toString(getQuantity())); XMLElement xreserve = addBooleanChild(xmlResult, "reserve"); if (xreserve != null) xreserve.setProperty("met", isReserveMet() ? "true" : "false"); addBooleanChild(xmlResult, "paypal"); XMLElement xfixed = addBooleanChild(xmlResult, "fixed"); if (xfixed != null && getQuantity() != 1) xfixed.setProperty("quantity", Integer.toString(getQuantity())); addBooleanChild(xmlResult, "private"); addStringChild(xmlResult, "location"); addStringChild(xmlResult, "highbidder"); return xmlResult; }