Example #1
0
 public synchronized XMLNode toXML(boolean export) {
   XMLNode node = toXML();
   if (export && (food.getSource() == Datasources.getUserFoods())) {
     if (food.getFood() instanceof Recipe) {
       node.addChild(((Recipe) food.getFood()).toXML(export));
     } else {
       node.addChild(food.getFood().toXML());
     }
   }
   return node;
 }
Example #2
0
 public synchronized XMLNode toXML() {
   XMLNode node = new XMLNode("serving");
   node.addAttribute("source", food.getSource().getName());
   node.addAttribute("food", food.getSourceID());
   if (date != 0) {
     node.addAttribute("date", date);
   }
   node.addAttribute("grams", grams);
   if (measure != Measure.GRAM) {
     node.addAttribute("measure", measure.getDescription());
   }
   if (meal != -1) {
     node.addAttribute("meal", meal);
   }
   return node;
 }