Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please help out in XML problem

 
Huang Qingyan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear experts,
I have a problem which is to convert the data into XML format and send to the other PC. Can you please kindly advise me on how to do these stuff which are 1. Convert data into XML. 2. Send to another PC.
So far my codes are below:
-------------------------------------------------------
package KengYiam;
import java.util.*;
import java.lang.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class ShoppingList extends javax.microedition.midlet.MIDlet implements CommandListener{
private Command exitCommand;
private Command checkOutCommand;
private Form screen;
private Display display;
private Item item1, item2, item3;
private Vector itemBag;
private StringItem productName, price, quantity;
private String myName = "Coca Cola";
private String myPrice = "1.25";
private String myQuantity = "1";
/*private String productName[] = new String[10];
private double price[] = new double[10];
private int quantity[] = new int[10];
*/

public ShoppingList(){
display = Display.getDisplay(this);

exitCommand = new Command("Quit", Command.EXIT, 2);
checkOutCommand = new Command("Checkout", Command.OK, 2);

screen = new Form("Temasek SuperMarket");
/* for(int i=0; i<itemBag.size(); i++){
Item myItem = (Item)itemBag.get(i);
}*/
//String aa = String.valueOf(itemBag.size());
productName = new StringItem("", "Product: " + myName);
screen.append(productName);
price = new StringItem("", "Price: $" + myPrice);
screen.append(price);
quantity = new StringItem("", "Quantity: " + myQuantity);
screen.append(quantity);

screen.addCommand(exitCommand);
screen.addCommand(checkOutCommand);
screen.setCommandListener(this);

}

public void startApp() throws MIDletStateChangeException{
display.setCurrent(screen);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}

/*public void createItem(){
item1 = new Item("Coca-Cola", 1.20, 1);
item2 = new Item("Tiger beer(can)", 3.50, 1);
item3 = new Item("Famous amos cookies", 8.30, 1);
itemBag.addElement(item1);
itemBag.addElement(item2);
itemBag.addElement(item3);
}*/

public void commandAction(Command c ,Displayable s){
if(c == exitCommand){
destroyApp(false);
notifyDestroyed();
}

else if(c == checkOutCommand){
productName.setText("Thank you for shopping with us");
price.setText("");
quantity.setText("");
//Convert data into XML format and send out to the server.
}

}

}
-------------------------------------------------------
Please kindly help me out. Thanks a million.
Best Regards,
Franco
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic