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

24-CONT-24D GUARDIAN SOLENOID COIL 24VDC DUTY CYCLE CONTINUOUS NEW QTY 1
$5.0
 24-CONT-24D GUARDIAN SOLENOID COIL 24VDC DUTY CYCLE CONTINUOUS NEW  QTY 1 pictureMac Valves 45A-LAB-DAAJ-1KA Solenoid Valve 45ALABDAAJ1KA
$58.77
Mac Valves 45A-LAB-DAAJ-1KA Solenoid Valve 45ALABDAAJ1KA pictureNumatics 031SA4004000061 Solenoid Valve 237-961B
$60.77
Numatics 031SA4004000061 Solenoid Valve 237-961B pictureGranzow 21WN8KB400 2-Way Internally Piloted Normally Closed 1-1/2 Solenoid Valve
$149.95
Granzow 21WN8KB400 2-Way Internally Piloted Normally Closed 1-1/2 Solenoid Valve pictureRed Hat Gas Solenoid Valve, 2 Way, NC, Alum, 1-1/2In JB8214270CSA
$400.0
Red Hat Gas Solenoid Valve, 2 Way, NC, Alum, 1-1/2In JB8214270CSA picture






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