Hi Guys, I have been trying to figure out how to encode and decode stuff in java for almost a day now.
I have followed this example. The problem is when I try to get the XML I have just built in the form of a string, I simply get an empty string. How ever, when I use the 'count' property, it prints the correct amount of nodes I have inserted.
So, what I would like to know is what do I have to do so that I can get the XML string I have just built? This is the code I am using to build the XML string:
kXMLElement xmlMessage = new kXMLElement();
xmlMessage.addChild(createElement("Type", String.valueOf(mobileMessage.MESSAGE_TYPE)));
xmlMessage.addChild(createElement("Source", mobileMessage.source));
xmlMessage.addChild(createElement("Date", mobileMessage.date));
xmlMessage.addChild(createElement("Content", mobileMessage.messageContent));
System.out.println("\n\n" + xmlMessage.toString() + "\n\n"); //This basically prints and empty String.
System.out.println("Children = " + xmlMessage.countChildren()); //This prints 4
I am using the J2ME version of NanoXML downloaded from here
Any help is appreciated. Thanks.