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


Lot of #5.75Lbs AMD AM27C010-200DC 1MB 128Kx8-bit UV Eprom memory picture

Lot of #5.75Lbs AMD AM27C010-200DC 1MB 128Kx8-bit UV Eprom memory

$236.78



Lot of #4.65Lbs Ti,Fujitsu,Intel,STi 128k/256k/512k UV Eprom Memory picture

Lot of #4.65Lbs Ti,Fujitsu,Intel,STi 128k/256k/512k UV Eprom Memory

$96.78



Nakajima WPT160 Electronic Portable Typewriter with Correct Film Ribbon picture

Nakajima WPT160 Electronic Portable Typewriter with Correct Film Ribbon

$299.99



Nightingale CXO 6200 Memory Foam, New Headrest, Lumbar Support Ergo Office Chair picture

Nightingale CXO 6200 Memory Foam, New Headrest, Lumbar Support Ergo Office Chair

$415.00



New Sealed AB 2080-MEMBAK-RTC Memory Backup, Data Log, Recipe ,High Accuracy RTC picture

New Sealed AB 2080-MEMBAK-RTC Memory Backup, Data Log, Recipe ,High Accuracy RTC

$280.66



Avnet UltraZed-EG AES-ZU3EG-1-SOM-I-G Zynq UltraScale+ MPSoC System-on-Module picture

Avnet UltraZed-EG AES-ZU3EG-1-SOM-I-G Zynq UltraScale+ MPSoC System-on-Module

$129.99







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