BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-14-2010, 09:12 AM   #1
Venkatesh92
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 7100
PIN: N/A
Carrier: Dev
Posts: 19
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
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
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
Venkatesh92
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 7100
PIN: N/A
Carrier: Dev
Posts: 19
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
Venkatesh92
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 7100
PIN: N/A
Carrier: Dev
Posts: 19
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



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Blackberry Advertising Banner Vinyl Mesh Sign Fruit Vegetable Berry Farm Fresh picture

Blackberry Advertising Banner Vinyl Mesh Sign Fruit Vegetable Berry Farm Fresh

$179.95



Nice Vintage Working RIM Blackberry 857, with Cradle, Collector's Item R857D-2-5 picture

Nice Vintage Working RIM Blackberry 857, with Cradle, Collector's Item R857D-2-5

$124.95



Black Berry (2) 8310 RBN41GW & (1) 9900 RDE71UW picture

Black Berry (2) 8310 RBN41GW & (1) 9900 RDE71UW

$75.00



Vintage RIM Blackberry R957M-2-5 with Belt Clip picture

Vintage RIM Blackberry R957M-2-5 with Belt Clip

$17.99



FARM FRESH BLACKBERRIES CLEARANCE BANNER Advertising Vinyl Flag Sign AAA picture

FARM FRESH BLACKBERRIES CLEARANCE BANNER Advertising Vinyl Flag Sign AAA

$249.77



Good Chimera Dongle for All Modules Samsung HTC BLACKBERRY NOKIA LG HUAWEI picture

Good Chimera Dongle for All Modules Samsung HTC BLACKBERRY NOKIA LG HUAWEI

$307.22







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