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>Rea der</title ><link>www.rfidreaders.com</l ink><descr iption>Rea der are used to read tag information</description>< /item></ch annel>" ;
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
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>Rea
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
Don't you have to call parser.parse()?
ASKER
No. i am using the following code after that "parser = new XmlParser(reader);"
ParseEvent pe = null;
parser.skip();
parser.read(Xml.START_TAG,
pe = parser.read();
Think it should be more like
pe = parser.read(Xml.START_TAG, null, "channel");
String text = pe.getText();
pe = parser.read(Xml.START_TAG,
String text = pe.getText();
ASKER
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.
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.
ASKER
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.
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?
How did you compile it then?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.