• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Please help out in XML problem

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic