Link to home
Start Free TrialLog in
Avatar of prashant_it
prashant_it

asked on

Java / Pocket PC Xml Parsing

Hi

I am developing a CDC/Personal Profile 1.0 application which is to run on Pocket PC 2003. I need to parse xml. For that i am using kxml.

The JVM i am using is CrE-ME 4.1

I used the follwing code to parse xml (tried from the string as well as from file).

XmlParser parser = null ;
String xml =  "<channel><item><title>Reader</title><link>www.rfidreaders.com</link><description>Reader are used to read tag information</description></item></channel>" ;
               
 Reader reader = new StringReader(xml) ;
               
try
{
      parser = new XmlParser(reader);
}
catch(Exception ex)
{
     //log error to file.
}

//log message: xml doc loaded.

But after this line is hit "parser = new XmlParser(reader);", there is no exception being thrown nor any code after that is executing.

I tried putting the kxml jar in the Creme's lib folder, but the result is the same.

Thanks in advance
Prashant
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Don't you have to call parser.parse()?
Avatar of prashant_it
prashant_it

ASKER


No. i am using the following code after that "parser = new XmlParser(reader);"

ParseEvent pe = null;
parser.skip();
parser.read(Xml.START_TAG, null, "channel");    
pe = parser.read();
Think it should be more like

pe = parser.read(Xml.START_TAG, null, "channel");    
String text = pe.getText();
I am using pe.getText() to read.

But the problem is after the line "parser = new XmlParser(reader);" no code is executing. I checked it by giving some logging comments.
Also no exception is being thrown.
Hi

I found the solution to the problem.

Actually the kxml i had downloaded form the site was in .zip format.
I renamed it to .jar and it worked.

Please tell me how to get my points refunded.

>>Actually the kxml i had downloaded form the site was in .zip format.

How did you compile it then?
ASKER CERTIFIED SOLUTION
Avatar of GranMod
GranMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial