Connected Device Configuration (cdc)
Posted on January 16, 2009

A connected device has, at a minimum, 512KB of read-only memory (ROM), 256KB of random
access memory (RAM), and some kind of network connection. The CDC is designed for devices
like television set-top boxes, car navigation systems, and high-end PDAs. The CDC specifies
that a full JVM (as defined in the Java Virtual Machine Specification, 2nd edition) must be
supported.
CDC is developed under the Java Community Process. For more information on the CDC,
see http://java.sun.com/products/cdc/. A Linux reference of CDC 1.0.1 implementation is
available now.
CDC 1.0.1 is the basis of the Personal Profile 1.0 stack. The Personal Profile 1.0 increases
the minimum memory requirement to 2.5MB of ROM and 1MB of RAM, and requires a robust
network plus a GUI display on a device that can support applet display.
CDC 1.1 is currently a work in progress. It will support Personal Profile 1.1 and will introduce
APIs to match the level of JDK 1.4.

XML parsing in a MIDP environment
Posted on January 06, 2009

You can use XML parsers in J2ME applications to interface with an existing XML service. For example, you could get a customized view of news on your phone from an aggregator site that summarizes headlines and story descriptions for a news site in XML format.

XML parsers tend to be bulky, with heavy run time memory requirements. In order to adapt to the MIDP environment, XML parsers must be small to meet the resource constraints of MIDP-based devices. They should also be easily portable, with minimum effort required to port them to MIDP.

Two frequently used XML parsers for resource-constrained devices are kXML and NanoXML. kXML is written exclusively for the J2ME platform (CLDC and MIDP). As of version 1.6.8 for MIDP, NanoXML supports DOM parsing. (See Resources for links to NanoXML and kXML.)

There are several performance issues that you should keep in mind while deploying XML parsing in a MIDP application:

  • Increase in size: An XML parser is code-intensive and increases the overall size of an application. This is a particularly important consideration for resource-constrained MIDP devices. There are several optimization techniques you can use to fight code expansion. First, you should remove resource files that are not in use. You should also use obfuscators that will remove unused classes, unused methods, and variables from your JAD file.
  • Heavy string parsing: XML parsers use intensive string parsing to perform their jobs; this will add to the overhead in MIDP applications with low runtime memory. XML documents that J2ME applications parse need to be small and contain as much useful information as possible.
  • Slow response time: As the MIDP application parses a relatively large amount of XML data, the response time will increase. The XML files to be parsed should be small, and the parsing should be done in a thread of execution that is separate from the main application.