BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-14-2010, 09:12 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 7100
PIN: N/A
Carrier: Dev
Posts: 19
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Large XML Parsing

Please Login to Remove!

Connection code for Getting xml data from URL:

HttpConnection connection = null;
connection =(HttpConnection) Connector.open(url, Connector.READ_WRITE, true);
connection.setRequestMethod(HttpConnection.GET);
connection.setRequestProperty("Content-Type","application/vnd.syncml+xml");
connection.setRequestProperty("Content-Length",String.valueOf(0));
connection.setRequestProperty("User-Agent","Profile/microedition.profiles Configuration/microedition.configuration");
connection.setRequestProperty("Content-Language","microedition.locale");
System.out.println("Connection getResponseCode==="+connection.getResponseCode());

try
{
connection = parsing.getHttpConnection(url);
inputStream = connection.openInputStream();
}catch(Exception e)
{
System.out.println("Connection getResponseCode=== "+e.getMessage());
e.printStackTrace();
}

ByteArrayOutputStream baos = new ByteArrayOutputStream();

try
{
byte[] buffer = new byte[10000];
int bytesRead = inputStream.read(buffer);
while (bytesRead > 0) {
baos.write(buffer, 0, bytesRead);
bytesRead = inputStream.read(buffer);
}
baos.close();
String result=baos.toString();
ByteArrayInputStream bais =
new ByteArrayInputStream(result.getBytes());

flightSchedule = getXMLObjects(bais);
}
catch (Exception e) {
// TODO: handle exception
}

Parsing Xml data code:

static FlightSchedule getXMLObjects(InputStream is) throws
ParserConfigurationException {
FlightScheduleXML xmlObjectHandler = new FlightScheduleXML();
try {
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse(is, xmlObjectHandler);
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return xmlObjectHandler.getFlightSchedule();
}


If Xml data is large parsing is not working,
Some limited Xml data means its working fine.
Any help to solve this issue....

Thanks in Adv,
Venkateshkumar
Offline  
Old 07-14-2010, 09:38 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

"not working" doesn't give us much to go on.

What is the specific exception thrown, and at what line?
Offline  
Old 07-15-2010, 12:17 AM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 7100
PIN: N/A
Carrier: Dev
Posts: 19
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

HttpConnection connection = null;
connection =(HttpConnection) Connector.open(url, Connector.READ_WRITE, true);
connection.setRequestMethod(HttpConnection.GET);
connection.setRequestProperty("Content-Type","application/vnd.syncml+xml");
connection.setRequestProperty("Content-Length",String.valueOf(0));
connection.setRequestProperty("User-Agent","Profile/microedition.profiles Configuration/microedition.configuration");
connection.setRequestProperty("Content-Language","microedition.locale");
System.out.println("Connection getResponseCode==="+connection.getResponseCode());


Connection getResponseCode===413 not works
Exception No stack trace

if Connection getResponseCode===200 means works fine
Offline  
Old 07-15-2010, 07:45 AM   #4 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 7100
PIN: N/A
Carrier: Dev
Posts: 19
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks its problem in MDS servies......

MDS will transfer data 256 Kb only.......

So am connecting through wifi not simulator

Thanks for reply........
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

MSA ALTAIR 5X LEL METER
$370.0
MSA ALTAIR 5X LEL METER pictureAltair 5x Multi gas Detector
$300.0
Altair 5x Multi gas Detector pictureMSA Altair 4X handheld multi gas/methane detector
$300.0
MSA Altair 4X handheld multi gas/methane detector pictureMSA ALTAIR 5X MULTIGAS DETECTOR INDUSTRIAL KIT (LEL, O2, CO, H2S, SO2 #10116927
$500.0
MSA ALTAIR 5X MULTIGAS DETECTOR INDUSTRIAL KIT (LEL, O2, CO, H2S, SO2 #10116927 pictureAltair Lighting 3" Recessed Light Kit with Swivel Trim And 50 Watt Bulbs,
$16.76
Altair Lighting 3






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.