Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Java / Pocket PC Xml Parsing

Posted on 2006-04-03
8
Medium Priority
?
190 Views
Last Modified: 2010-03-31
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
0
Comment
Question by:prashant_it
  • 3
  • 3
7 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 16358549
Don't you have to call parser.parse()?
0
 

Author Comment

by:prashant_it
ID: 16358583

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();
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16358634
Think it should be more like

pe = parser.read(Xml.START_TAG, null, "channel");    
String text = pe.getText();
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:prashant_it
ID: 16367601
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.
0
 

Author Comment

by:prashant_it
ID: 16368081
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.

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16368116
>>Actually the kxml i had downloaded form the site was in .zip format.

How did you compile it then?
0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16672879
PAQed with points refunded (50)

GranMod
Community Support Moderator
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month15 days, 13 hours left to enroll

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question