File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes Please help out in XML problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Reply Bookmark "Please help out in XML problem" Watch "Please help out in XML problem" New topic
Author

Please help out in XML problem

Huang Qingyan
Greenhorn

Joined: Jan 18, 2002
Posts: 23
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
 
 
subject: Please help out in XML problem
 
Threads others viewed
JPopup and JTree Problem
Why does "Form.append(ImageItem i) not work.
Please help in reading a file
J2Me datagram connection with multicast socket server
System Information Code not running
jQuery in Action, 2nd edition

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture